Skip to content

Commit

Permalink
feat(kesaseteli): update summer voucher price for year 2024 to 350e
Browse files Browse the repository at this point in the history
also support Excel exporting previous years' summer vouchers with the
old price of 325e, add test for this

refs YJDH-683
  • Loading branch information
karisal-anders committed Jan 22, 2024
1 parent ada2b58 commit 22ae6aa
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class ExcelField(NamedTuple):
30,
"#F7DAE3",
),
ExcelField(SUM_FIELD_TITLE, "325", [], 15, "#F7DAE3"),
ExcelField(SUM_FIELD_TITLE, "%s", ["value_in_euros"], 15, "#F7DAE3"),
ExcelField(_("Tarkastaja etunimi"), "", [], 30, "#F7DAE3"),
ExcelField(_("Tarkastaja sukunimi"), "", [], 30, "#F7DAE3"),
ExcelField(_("Hyväksyjä etunimi"), "", [], 30, "#F7DAE3"),
Expand Down
12 changes: 6 additions & 6 deletions backend/kesaseteli/applications/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,8 @@ msgstr ""
msgid "Kesäsetelisi ja ohjeet sen käyttämiseen"
msgstr "Your Summer Job Voucher and instructions for its use"

msgid "Helsinki, Kesäseteli, 325€"
msgstr "Helsinki, Summer Job Voucher, 325€"
msgid "Helsinki, Kesäseteli, 350€"
msgstr "Helsinki, Summer Job Voucher, 350€"

msgid "Kesäsetelisi, ole hyvä"
msgstr "Here is your Summer Job Voucher"
Expand All @@ -608,8 +608,8 @@ msgstr "Summer Job Voucher number:"
msgid "Kesäsetelin summa:"
msgstr "Summer Job Voucher’s amount:"

msgid "325€"
msgstr "€325"
msgid "350€"
msgstr "€350"

msgid "Postinumero:"
msgstr "Postal code:"
Expand Down Expand Up @@ -699,10 +699,10 @@ msgstr ""
"and the City of Helsinki."

msgid ""
"Kaupunki korvaa 325 euroa työnantajalle, joka palkkaa Kesäseteliin "
"Kaupunki korvaa 350 euroa työnantajalle, joka palkkaa Kesäseteliin "
"oikeutetun nuoren töihin 1.6.–15.8.2023 välisenä aikana."
msgstr ""
"The City of Helsinki will provide a reimbursement of EUR 325 to each "
"The City of Helsinki will provide a reimbursement of EUR 350 to each "
"employer who a young person with the summer job voucher between 1 June and "
"15 August 2022."

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ msgstr ""
msgid "Kesäsetelisi ja ohjeet sen käyttämiseen"
msgstr ""

msgid "Helsinki, Kesäseteli, 325€"
msgid "Helsinki, Kesäseteli, 350€"
msgstr ""

msgid "Kesäsetelisi, ole hyvä"
Expand All @@ -595,7 +595,7 @@ msgstr ""
msgid "Kesäsetelin summa:"
msgstr ""

msgid "325€"
msgid "350€"
msgstr ""

msgid "Postinumero:"
Expand Down Expand Up @@ -669,7 +669,7 @@ msgid ""
msgstr ""

msgid ""
"Kaupunki korvaa 325 euroa työnantajalle, joka palkkaa Kesäseteliin "
"Kaupunki korvaa 350 euroa työnantajalle, joka palkkaa Kesäseteliin "
"oikeutetun nuoren töihin 1.6.–15.8.2023 välisenä aikana."
msgstr ""

Expand Down
12 changes: 6 additions & 6 deletions backend/kesaseteli/applications/locale/sv/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,8 @@ msgstr ""
msgid "Kesäsetelisi ja ohjeet sen käyttämiseen"
msgstr "Din Sommarsedel och instruktioner för hur du använder den"

msgid "Helsinki, Kesäseteli, 325€"
msgstr "Helsingfors, Sommarsedel, 325€"
msgid "Helsinki, Kesäseteli, 350€"
msgstr "Helsingfors, Sommarsedel, 350€"

msgid "Kesäsetelisi, ole hyvä"
msgstr "Din Sommarsedel, varsågod"
Expand All @@ -607,8 +607,8 @@ msgstr "Sommarsedelns nummer:"
msgid "Kesäsetelin summa:"
msgstr "Sommadsedelns belopp:"

msgid "325€"
msgstr "325€"
msgid "350€"
msgstr "350€"

msgid "Postinumero:"
msgstr "Postnummer:"
Expand Down Expand Up @@ -696,10 +696,10 @@ msgstr ""
"Helsingfors stad."

msgid ""
"Kaupunki korvaa 325 euroa työnantajalle, joka palkkaa Kesäseteliin "
"Kaupunki korvaa 350 euroa työnantajalle, joka palkkaa Kesäseteliin "
"oikeutetun nuoren töihin 1.6.–15.8.2023 välisenä aikana."
msgstr ""
"Helsingfors stad betalar 325 euro till en arbetsgivare som anställer en elev "
"Helsingfors stad betalar 350 euro till en arbetsgivare som anställer en elev "
"i årskurs 9 med Sommarsedeln för sommaren mellan den 1 juni och den 15 "
"augusti 2022."

Expand Down
11 changes: 10 additions & 1 deletion backend/kesaseteli/applications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ def _template_image(filename, content_id) -> MIMEImage:

def youth_summer_voucher_logo(self, language) -> MIMEImage:
return YouthSummerVoucher._template_image(
filename=f"youth_summer_voucher-325e-{language}.png",
filename=f"youth_summer_voucher-350e-{language}.png",
content_id="youth_summer_voucher_logo",
)

Expand Down Expand Up @@ -1117,6 +1117,15 @@ class EmployerSummerVoucher(HistoricalModel, TimeStampedModel, UUIDModel):

ordering = models.IntegerField(default=0)

@property
def value_in_euros(self) -> int:
if self.created_at.date() < date(2024, 6, 1):
# Use 2023 year's value (325e) for late coming employer applications in 2024
# before 2024's summer job period starts (i.e. 1st of June 2024).
return 325
else:
return 350

@property
def last_submitted_at(self) -> Optional[datetime]:
if (
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<tr style="background-color:#e1f6ea;margin:0 0 0 0;padding:0 0 0 0">
<td colspan="2">
<img alt="{% trans 'Helsinki, Kesäseteli, 325€' %}" src="cid:youth_summer_voucher_logo">
<img alt="{% trans 'Helsinki, Kesäseteli, 350€' %}" src="cid:youth_summer_voucher_logo">
</td>
</tr>

Expand All @@ -29,7 +29,7 @@ <h2>{% trans 'Kesäsetelisi, ole hyvä' %}</h2>
<p>
<strong>{{first_name}} {{last_name}}</strong><br/>
<strong>{% trans 'Kesäsetelinumero:' %}</strong> {{summer_voucher_serial_number}}<br/>
<strong>{% trans 'Kesäsetelin summa:' %}</strong> {% trans '325€' %}<br/>
<strong>{% trans 'Kesäsetelin summa:' %}</strong> {% trans '350€' %}<br/>
<strong>{% trans 'Postinumero:' %}</strong> {{postcode}}<br/>
<strong>{% trans 'Koulu:' %}</strong> {{school}}<br/>
<strong>{% trans 'Puhelinnumero:' %}</strong> {{phone_number}}<br/>
Expand Down Expand Up @@ -64,7 +64,7 @@ <h2>{% trans 'Ohjeita työnhakijalle' %}</h2>
<h2>{% trans 'Ohjeita työnantajalle' %}</h2>
<p>
{% trans 'Kesäseteli on nuorten, yrittäjien ja Helsingin kaupungin yhteinen hanke.' %}
{% trans 'Kaupunki korvaa 325 euroa työnantajalle, joka palkkaa Kesäseteliin oikeutetun nuoren töihin 1.6.–15.8.2023 välisenä aikana.' %}
{% trans 'Kaupunki korvaa 350 euroa työnantajalle, joka palkkaa Kesäseteliin oikeutetun nuoren töihin 1.6.–15.8.2023 välisenä aikana.' %}
{% trans 'Kesätyön vähimmäisvaatimuksina ovat 60 tunnin työaika ja 400 euron palkka.' %}
</p>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{{first_name}} {{last_name}}
{% trans 'Kesäsetelinumero:' %} {{summer_voucher_serial_number}}
{% trans 'Kesäsetelin summa:' %} {% trans '325€' %}
{% trans 'Kesäsetelin summa:' %} {% trans '350€' %}
{% trans 'Postinumero:' %} {{postcode}}
{% trans 'Koulu:' %} {{school}}
{% trans 'Puhelinnumero:' %} {{phone_number}}
Expand All @@ -27,7 +27,7 @@
------------------------------------------------------------------------
{% trans 'Ohjeita työnantajalle' %}:

{% trans 'Kesäseteli on nuorten, yrittäjien ja Helsingin kaupungin yhteinen hanke.' %} {% trans 'Kaupunki korvaa 325 euroa työnantajalle, joka palkkaa Kesäseteliin oikeutetun nuoren töihin 1.6.–15.8.2023 välisenä aikana.' %} {% trans 'Kesätyön vähimmäisvaatimuksina ovat 60 tunnin työaika ja 400 euron palkka.' %}
{% trans 'Kesäseteli on nuorten, yrittäjien ja Helsingin kaupungin yhteinen hanke.' %} {% trans 'Kaupunki korvaa 350 euroa työnantajalle, joka palkkaa Kesäseteliin oikeutetun nuoren töihin 1.6.–15.8.2023 välisenä aikana.' %} {% trans 'Kesätyön vähimmäisvaatimuksina ovat 60 tunnin työaika ja 400 euron palkka.' %}

{% trans 'Muut käyttöehdot voit lukea täältä:' %}
{% trans 'https://nuorten.helsinki/opiskelu-ja-tyo/kesaseteli/tyonantajalle-2/' %}
Expand Down
45 changes: 45 additions & 0 deletions backend/kesaseteli/applications/tests/test_excel_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
REMOVABLE_TALPA_FIELD_TITLES,
SALARY_PAID_FIELD_TITLE,
SPECIAL_CASE_FIELD_TITLE,
SUM_FIELD_TITLE,
WORK_HOURS_FIELD_TITLE,
)
from applications.models import EmployerSummerVoucher, YouthApplication
Expand Down Expand Up @@ -327,6 +328,8 @@ def employer_summer_voucher_sorting_key(voucher: EmployerSummerVoucher):
assert (output_column.value is None and salary_paid is None) or Decimal(
output_column.value
) == salary_paid
elif excel_field.title == SUM_FIELD_TITLE:
assert output_column.value == str(voucher.value_in_euros)
elif excel_field.model_fields == ["attachments"]:
expected_attachment_uri = get_attachment_uri(
voucher, excel_field, voucher.attachments, response.wsgi_request
Expand All @@ -352,6 +355,48 @@ def employer_summer_voucher_sorting_key(voucher: EmployerSummerVoucher):
), excel_field.title


@pytest.mark.django_db
@override_settings(NEXT_PUBLIC_MOCK_FLAG=False)
@pytest.mark.parametrize(
"employer_summer_voucher_creation_date,sum_field_value",
[
(date(2021, 6, 1), "325"),
(date(2022, 6, 1), "325"),
(date(2023, 6, 1), "325"),
(date(2024, 1, 1), "325"),
(date(2024, 5, 31), "325"),
(date(2024, 6, 1), "350"),
(date(2024, 12, 31), "350"),
],
)
def test_excel_view_download_sum_field_value( # noqa: C901
staff_client,
employer_summer_voucher_creation_date: date,
sum_field_value: str,
):
with freeze_time(employer_summer_voucher_creation_date):
EmployerSummerVoucherFactory(
application=EmployerApplicationFactory(
status=EmployerApplicationStatus.SUBMITTED
)
)

# Use earlier date because fetching file fails if frozen date is in the future
with freeze_time(date(employer_summer_voucher_creation_date.year, 1, 1)):
response = staff_client.get(
f"{excel_download_url()}?download=annual&columns=talpa"
)

workbook = openpyxl.load_workbook(filename=BytesIO(response.getvalue()))
rows_generator = workbook.active.rows
header_row = next(rows_generator)
data_row = next(rows_generator)

titles = [column.value for column in header_row]
sum_field_index = titles.index(SUM_FIELD_TITLE)
assert data_row[sum_field_index].value == sum_field_value


@pytest.mark.django_db
@override_settings(
EXCEL_DOWNLOAD_BATCH_SIZE=3,
Expand Down
2 changes: 1 addition & 1 deletion frontend/kesaseteli/youth/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"youthApplication": {
"title": "Sign up to receive your personal Summer Job Voucher",
"paragraph_1": "Earning your own money is fun and easy! The Summer Job Voucher is personal and worth 325€ for the employer.",
"paragraph_1": "Earning your own money is fun and easy! The Summer Job Voucher is personal and worth 350€ for the employer.",
"form" : {
"title": "Summer Job Voucher information",
"info": "Please fill in the information as it appears on your Kela card",
Expand Down
2 changes: 1 addition & 1 deletion frontend/kesaseteli/youth/public/locales/fi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"youthApplication": {
"title": "Rekisteröidy ja saat henkilökohtaisen Kesäsetelin käyttöösi",
"paragraph_1": "Oman rahan tienaaminen on hauskaa ja helppoa! Kesäseteli on henkilökohtainen ja sen arvo on työnantajalle 325 euroa.",
"paragraph_1": "Oman rahan tienaaminen on hauskaa ja helppoa! Kesäseteli on henkilökohtainen ja sen arvo on työnantajalle 350 euroa.",
"form" : {
"title": "Kesäsetelin tiedot",
"info": "Täytäthän tiedot samalla tavalla kuin kelakortissasi",
Expand Down
2 changes: 1 addition & 1 deletion frontend/kesaseteli/youth/public/locales/sv/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"youthApplication": {
"title": "Registrera dig och få din personlig Sommarsedel",
"paragraph_1": "Det är roligt och enkelt att tjäna egna pengar!\nSommarsedeln är personlig och värd 325 euro för arbetsgivaren.",
"paragraph_1": "Det är roligt och enkelt att tjäna egna pengar!\nSommarsedeln är personlig och värd 350 euro för arbetsgivaren.",
"form" : {
"title": "Information om Sommarsedeln",
"info": "Fyll i uppgifterna på samma sätt som på ditt FPA-kort",
Expand Down

0 comments on commit 22ae6aa

Please sign in to comment.