Skip to content

Commit

Permalink
fix translation, add optgroup for frequency, add unit test for weekly…
Browse files Browse the repository at this point in the history
… frequency on monday
  • Loading branch information
ptitloup committed Sep 19, 2023
1 parent 998f5d0 commit bc82951
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 17 deletions.
Binary file modified pod/locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
18 changes: 12 additions & 6 deletions pod/locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Pod\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-14 14:46+0000\n"
"POT-Creation-Date: 2023-09-19 12:22+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: ptitloup <[email protected]>\n"
"Language-Team: Pod Team [email protected]\n"
Expand Down Expand Up @@ -4843,7 +4843,8 @@ msgstr "La date de début doit être antérieure à la date de fin récurrente"
msgid ""
"In case of weekly recurring, the day of the start date must be selected."
msgstr ""
"En cas de récurrence hebdomadaire, le jour de la date de début doit être sélectionné."
"En cas de récurrence hebdomadaire, le jour de la date de début doit être "
"sélectionné."

#: pod/meeting/forms.py pod/playlist/forms.py pod/video/forms.py
msgid "Owner of the video cannot be an additional owner too"
Expand Down Expand Up @@ -4893,6 +4894,15 @@ msgstr "Mois"
msgid "Yearly"
msgstr "Année"

#: pod/meeting/models.py
msgid "Choose repeat frequency"
msgstr "choisissez la fréquence de répétition"

#: pod/meeting/models.py
#: pod/meeting/templates/meeting/recurring_options_modal_form.html
msgid "Frequency"
msgstr "Fréquence"

#: pod/meeting/models.py
msgid "Every month on this date"
msgstr "Tous les mois à cette date"
Expand Down Expand Up @@ -5363,10 +5373,6 @@ msgstr "Impossible de trouver des informations sur la réunion"
msgid "End the meeting"
msgstr "Terminer la réunion"

#: pod/meeting/templates/meeting/recurring_options_modal_form.html
msgid "Frequency"
msgstr "Fréquence"

#: pod/meeting/templates/meeting/recurring_options_modal_form.html
msgid "Repeat every"
msgstr "Répéter tou(te)s les"
Expand Down
2 changes: 1 addition & 1 deletion pod/locale/fr/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Esup-Pod\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-14 14:46+0000\n"
"POT-Creation-Date: 2023-09-19 12:22+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: obado <[email protected]>\n"
"Language-Team: \n"
Expand Down
17 changes: 11 additions & 6 deletions pod/locale/nl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Pod\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-14 14:46+0000\n"
"POT-Creation-Date: 2023-09-19 12:22+0000\n"
"PO-Revision-Date: 2023-06-08 14:37+0200\n"
"Last-Translator: obado <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -4598,7 +4598,7 @@ msgstr ""

#: pod/meeting/forms.py pod/meeting/templates/meeting/add_or_edit.html
msgid ""
"In case of weekly recurring, the day of the start date has to be selected."
"In case of weekly recurring, the day of the start date must be selected."
msgstr ""

#: pod/meeting/forms.py pod/playlist/forms.py pod/video/forms.py
Expand Down Expand Up @@ -4645,6 +4645,15 @@ msgstr ""
msgid "Yearly"
msgstr ""

#: pod/meeting/models.py
msgid "Choose repeat frequency"
msgstr ""

#: pod/meeting/models.py
#: pod/meeting/templates/meeting/recurring_options_modal_form.html
msgid "Frequency"
msgstr ""

#: pod/meeting/models.py
msgid "Every month on this date"
msgstr ""
Expand Down Expand Up @@ -5084,10 +5093,6 @@ msgstr ""
msgid "End the meeting"
msgstr ""

#: pod/meeting/templates/meeting/recurring_options_modal_form.html
msgid "Frequency"
msgstr ""

#: pod/meeting/templates/meeting/recurring_options_modal_form.html
msgid "Repeat every"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion pod/locale/nl/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Esup-Pod\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-14 14:46+0000\n"
"POT-Creation-Date: 2023-09-19 12:22+0000\n"
"PO-Revision-Date: 2023-02-08 15:22+0100\n"
"Last-Translator: obado <[email protected]>\n"
"Language-Team: \n"
Expand Down
7 changes: 6 additions & 1 deletion pod/meeting/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,18 @@ class Meeting(models.Model):

DAILY, WEEKLY, MONTHLY, YEARLY = "daily", "weekly", "monthly", "yearly"

INTERVAL_CHOICES = (
INTERVAL_FREQUENCIES = (
(DAILY, _("Daily")),
(WEEKLY, _("Weekly")),
(MONTHLY, _("Monthly")),
(YEARLY, _("Yearly")),
)

INTERVAL_CHOICES = (
('', '%s' % _("Choose repeat frequency")),
('%s :' % _("Frequency"), INTERVAL_FREQUENCIES),
)

DATE_DAY, NTH_DAY = "date_day", "nth_day"
MONTHLY_TYPE_CHOICES = (
(DATE_DAY, _("Every month on this date")),
Expand Down
21 changes: 19 additions & 2 deletions pod/meeting/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def test_models_meetings_get_occurrences_weekly_nb_occurrences_filled(self):
"""Weekly occurences with number of occurrences filled in but not date \
of end of reccurrence."""
meeting = Meeting.objects.get(id=1)
meeting.start_at = datetime(2022, 7, 6, 14, 0, 0)
meeting.start_at = timezone.make_aware(datetime(2022, 7, 6, 14, 0, 0))
meeting.recurrence = "weekly"
meeting.frequency = 1
meeting.recurring_until = None
Expand Down Expand Up @@ -432,7 +432,7 @@ def test_models_meetings_get_occurrences_weekly_nb_occurrences_filled(self):
def test_models_meetings_get_occurrences_weekly_reset_weekdays(self):
"""reset weekdays if recurrence not equal to weekly"""
meeting = Meeting.objects.get(id=1)
meeting.start_at = datetime(2022, 7, 6, 14, 0, 0)
meeting.start_at = timezone.make_aware(datetime(2022, 7, 6, 14, 0, 0))
meeting.recurrence = "weekly"
meeting.frequency = 1
meeting.recurring_until = None
Expand All @@ -453,6 +453,23 @@ def test_models_meetings_get_occurrences_weekly_reset_weekdays(self):
meeting.refresh_from_db()
self.assertEqual(meeting.weekdays, "126")

def test_models_meetings_get_occurrences_weekly_on_monday(self):
"""check a recurring meeting each monday"""
meeting = Meeting.objects.get(id=1)
meeting.start_at = timezone.make_aware(datetime(2023, 9, 18, 10, 0, 0))
meeting.recurrence = "weekly"
meeting.frequency = 1
meeting.recurring_until = None
meeting.nb_occurrences = 12
meeting.weekdays = "0" # on monday
meeting.save()
meeting.refresh_from_db()
occurrences = meeting.get_occurrences(meeting.start, meeting.recurring_until)
self.assertEqual(len(occurrences), 12)
next_occurrence = meeting.next_occurrence(meeting.start)
self.assertEqual(next_occurrence, date(2023, 9, 25))
self.assertEqual(next_occurrence.weekday(), 0)

# Monthly

def test_models_meetings_get_occurrences_monthly_nb_occurrences_filled_date(self):
Expand Down

0 comments on commit bc82951

Please sign in to comment.