Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mhieta committed Feb 12, 2024
2 parents e24a9b3 + 624db0e commit 300a6b7
Show file tree
Hide file tree
Showing 17 changed files with 447 additions and 134 deletions.
58 changes: 30 additions & 28 deletions locale/fi/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-31 23:25+0200\n"
"POT-Creation-Date: 2024-02-11 09:55+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -619,18 +619,6 @@ msgstr "Heti"
msgid "From"
msgstr "Alkaen"

msgid "Arrived"
msgstr "Saapunut"

msgid "Processing"
msgstr "Käsittelyssä"

msgid "Accepted"
msgstr "Hyväksytty"

msgid "Rejected"
msgstr "Hylätty"

msgid "Payment in progress"
msgstr "Maksussa"

Expand All @@ -646,6 +634,9 @@ msgstr "Tuleva ajoneuvo"
msgid "Next parking zone"
msgstr "Tuleva pysäköintialue"

msgid "Bypass Traficom validation"
msgstr "Ohita Traficom-tarkistus"

msgid "Vehicle changed date"
msgstr "Ajoneuvon tietojen muuttamispäivä"

Expand Down Expand Up @@ -758,6 +749,12 @@ msgstr "Avoin"
msgid "Request for approval"
msgstr "Hyväksyttävänä"

msgid "Accepted"
msgstr "Hyväksytty"

msgid "Rejected"
msgstr "Hylätty"

msgid "Permits"
msgstr "Pysäköintitunnukset"

Expand Down Expand Up @@ -1091,22 +1088,27 @@ msgstr "Pysäköintitunnukseen on päivitetty tilapäisen ajoneuvon tiedot."
msgid "Original vehicle has been restored to your permit."
msgstr "Pysäköintitunnukseen on päivitetty alkuperäisen ajoneuvon tiedot."

#, python-format
msgid ""
"The attached vehicle is entitled to a 50%% discount in street parking when "
"paying with parking applications."
msgstr ""
"Oheinen ajoneuvo on oikeutettu 50%% alennukseen kadunvarsipysäköinnissä "
"pysäköintisovelluksilla maksettaessa."
msgid "THIS MESSAGE HAS BEEN SENT AUTOMATICALLY, DO NOT REPLY"
msgstr "TÄMÄ ON AUTOMAATTISESTI LÄHETETTY VIESTI, ÄLÄ VASTAA TÄHÄN"

msgid "Dear partner!"
msgstr "Hyvä yhteistyökumppani!"

msgid "A low-emission vehicle parking benefit has been added to the vehicle."
msgstr "Ohessa ajoneuvo, jolle on myönnetty vähäpäästöisen auton pysäköintietuus."

msgid "Discount: Low-emission vehicle"
msgstr "Alennus: Vähäpäästöinen ajoneuvo"
msgid "With kind regards"
msgstr "Ystävällisin terveisin"

msgid "Discount valid from"
msgstr "Alennusoikeus voimassa alkaen"
msgid "Urban environmental service"
msgstr "Kaupunkiympäristön asiakaspalvelu"

msgid "The right to a discount has been removed from the vehicle."
msgstr "Ajoneuvolta on poistettu oikeus alennukseen."
msgid "Tel. 09-310 22111"
msgstr "Puh. 09-310 22111"

msgid "Discount right ends"
msgstr "Alennusoikeus päättyy"
msgid "This vehicle is no longer subject to a discount"
msgstr "Ajoneuvolta on poistettu oikeus alennukseen"

msgid ""
"A low-emission vehicle parking benefit has been removed from the vehicle."
msgstr "Ohessa ajoneuvo, jolta on poistettu vähäpäästöisen auton pysäköintietuus."
59 changes: 31 additions & 28 deletions locale/sv/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-31 23:25+0200\n"
"POT-Creation-Date: 2024-02-11 09:55+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -614,18 +614,6 @@ msgstr "Genast"
msgid "From"
msgstr "Från"

msgid "Arrived"
msgstr "Anlände"

msgid "Processing"
msgstr "Under behandling"

msgid "Accepted"
msgstr "Accepterad"

msgid "Rejected"
msgstr "Avslå"

msgid "Payment in progress"
msgstr "Betalning pågår"

Expand All @@ -641,6 +629,9 @@ msgstr "Nästa fordon"
msgid "Next parking zone"
msgstr "Nästa parkering zone"

msgid "Bypass Traficom validation"
msgstr "Bypass Traficom-validering"

msgid "Vehicle changed date"
msgstr "Fordonet ändringdatum"

Expand Down Expand Up @@ -755,6 +746,12 @@ msgstr "Öppna"
msgid "Request for approval"
msgstr "Acceptabel"

msgid "Accepted"
msgstr "Accepterad"

msgid "Rejected"
msgstr "Avslå"

msgid "Permits"
msgstr "Parkeringstillstånder"

Expand Down Expand Up @@ -970,7 +967,8 @@ msgstr "Fordonet %(registration_number)s är avställd"

#, python-format
msgid "Vehicle's %(registration_number)s weight exceeds maximum allowed limit"
msgstr "Fordonets %(registration_number)s vikt överstiger den högsta tillåtna gränsen"
msgstr ""
"Fordonets %(registration_number)s vikt överstiger den högsta tillåtna gränsen"

msgid "The person has no driving licence"
msgstr "Personen har inget körkort"
Expand Down Expand Up @@ -1093,22 +1091,27 @@ msgstr "Tillfällig fordonsinformation har uppdaterats till ditt tillstånd."
msgid "Original vehicle has been restored to your permit."
msgstr "Originalfordonet har återställts till ditt tillstånd."

#, python-format
msgid ""
"The attached vehicle is entitled to a 50%% discount in street parking when "
"paying with parking applications."
msgstr ""
"Det bifogade fordonet har rätt till 50%% rabatt på gatuparkering när betala "
"med parkeringsansökningar."
msgid "THIS MESSAGE HAS BEEN SENT AUTOMATICALLY, DO NOT REPLY"
msgstr "DETTA ÄR AUTOMATISKT SKICKA MEDDELANDE, SVARA INTE PÅ DETTA"

msgid "Dear partner!"
msgstr "Bra partner!"

msgid "A low-emission vehicle parking benefit has been added to the vehicle."
msgstr "En förmån för fordonsparkering med låga utsläpp har lagts till fordonet."

msgid "Discount: Low-emission vehicle"
msgstr "Rabatt: Fordon med låga utsläpp"
msgid "With kind regards"
msgstr "Vänliga Hälsningar"

msgid "Discount valid from"
msgstr "Rabatten giltig från"
msgid "Urban environmental service"
msgstr "Stadsmiljö kundservice"

msgid "The right to a discount has been removed from the vehicle."
msgid "Tel. 09-310 22111"
msgstr "Tel. 09-310 22111"

msgid "This vehicle is no longer subject to a discount"
msgstr "Rätten till rabatt har tagits bort från fordonet."

msgid "Discount right ends"
msgstr "Rabatten till höger upphör"
msgid ""
"A low-emission vehicle parking benefit has been removed from the vehicle."
msgstr "En förmån för fordonsparkering med låga utsläpp har tagits bort från fordonet."
5 changes: 4 additions & 1 deletion parking_permits/admin_resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,10 @@ def resolve_announcement(obj, info, announcement_id):

def post_create_announcement(announcement: Announcement):
customer_ids = (
ParkingPermit.objects.filter(parking_zone__in=announcement.parking_zones)
ParkingPermit.objects.filter(
parking_zone__in=announcement.parking_zones,
status=ParkingPermitStatus.VALID,
)
.values_list("customer_id", flat=True)
.order_by("customer")
.distinct()
Expand Down
7 changes: 3 additions & 4 deletions parking_permits/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ def automatic_expiration_remind_notification_of_permits():
end_time__lt=now + relativedelta(weeks=1), status=ParkingPermitStatus.VALID
)
for permit in expiring_permits:
send_permit_email(PermitEmailType.EXPIRATION_REMIND, permit)
count += 1
success = send_permit_email(PermitEmailType.EXPIRATION_REMIND, permit)
if success:
count += 1
logger.info(
"Automatically sending remind notifications for permits completed. "
f"{count} notifications sent."
Expand All @@ -79,8 +80,6 @@ def automatic_syncing_of_permits_to_parkkihubi():
statuses_to_sync = [
ParkingPermitStatus.CLOSED,
ParkingPermitStatus.VALID,
ParkingPermitStatus.ACCEPTED,
ParkingPermitStatus.REJECTED,
]
permits = ParkingPermit.objects.filter(
synced_with_parkkihubi=False, status__in=statuses_to_sync
Expand Down
11 changes: 7 additions & 4 deletions parking_permits/customer_permit.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
OPEN_ENDED = ContractType.OPEN_ENDED
DRAFT = ParkingPermitStatus.DRAFT
VALID = ParkingPermitStatus.VALID
PROCESSING = ParkingPermitStatus.PROCESSING
PAYMENT_IN_PROGRESS = ParkingPermitStatus.PAYMENT_IN_PROGRESS
CANCELLED = ParkingPermitStatus.CANCELLED
FROM = ParkingPermitStartType.FROM
FIXED_PERIOD = ContractType.FIXED_PERIOD

Expand Down Expand Up @@ -174,8 +174,8 @@ def get(self):
products.append(product)
permit.products = products

# automatically change permit status to draft if payment is not completed in configured time
# (default 20 minutes)
# automatically cancel permit and it's latest order if payment is not completed in configured time
# (default 15 minutes)
payment_wait_time_buffer = (
settings.TALPA_ORDER_PAYMENT_WEBHOOK_WAIT_BUFFER_MINS
)
Expand All @@ -188,7 +188,10 @@ def get(self):
)
< tz.localtime(tz.now())
):
permit.status = DRAFT
permit.status = CANCELLED
latest_order = permit.latest_order
latest_order.status = OrderStatus.CANCELLED
latest_order.save()
permit.save()
permits.append(permit)
return permits
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.core.management.base import BaseCommand

from parking_permits.cron import automatic_expiration_remind_notification_of_permits
# from parking_permits.cron import automatic_expiration_remind_notification_of_permits


class Command(BaseCommand):
Expand All @@ -10,5 +10,5 @@ def handle(self, *args, **options):
self.stdout.write(
self.style.SUCCESS("Reminding of permit expiration started...")
)
automatic_expiration_remind_notification_of_permits()
# automatic_expiration_remind_notification_of_permits()
self.stdout.write(self.style.SUCCESS("Reminding of permit expiration done."))
28 changes: 28 additions & 0 deletions parking_permits/migrations/0049_alter_parkingpermit_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 4.2.1 on 2024-02-06 11:47

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("parking_permits", "0048_merge_20240202_0838"),
]

operations = [
migrations.AlterField(
model_name="parkingpermit",
name="status",
field=models.CharField(
choices=[
("DRAFT", "Draft"),
("PAYMENT_IN_PROGRESS", "Payment in progress"),
("VALID", "Valid"),
("CANCELLED", "Cancelled"),
("CLOSED", "Closed"),
],
default="DRAFT",
max_length=32,
verbose_name="Status",
),
),
]
15 changes: 9 additions & 6 deletions parking_permits/models/parking_permit.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,9 @@ class ParkingPermitStartType(models.TextChoices):

class ParkingPermitStatus(models.TextChoices):
DRAFT = "DRAFT", _("Draft")
ARRIVED = "ARRIVED", _("Arrived")
PROCESSING = "PROCESSING", _("Processing")
ACCEPTED = "ACCEPTED", _("Accepted")
REJECTED = "REJECTED", _("Rejected")
PAYMENT_IN_PROGRESS = "PAYMENT_IN_PROGRESS", _("Payment in progress")
VALID = "VALID", _("Valid")
CANCELLED = "CANCELLED", _("Cancelled")
CLOSED = "CLOSED", _("Closed")


Expand Down Expand Up @@ -344,8 +341,14 @@ def can_end_immediately(self):

@property
def can_end_after_current_period(self):
return self.is_valid and (
self.end_time is None or self.current_period_end_time < self.end_time
if not self.is_valid:
return False

if self.end_time is None:
return False

return timezone.localdate(self.current_period_end_time) <= timezone.localdate(
self.end_time
)

@property
Expand Down
5 changes: 1 addition & 4 deletions parking_permits/schema/parking_permit_admin.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,9 @@ type AnnouncementNode {

enum ParkingPermitStatus {
DRAFT
ARRIVED
PROCESSING
ACCEPTED
REJECTED
PAYMENT_IN_PROGRESS
VALID
CANCELLED
CLOSED
}

Expand Down
Loading

0 comments on commit 300a6b7

Please sign in to comment.