Various improvements to the subevent creation form (#1670)

This commit is contained in:
Raphael Michel
2020-05-06 15:50:43 +02:00
committed by GitHub
parent 094450564a
commit ea04c85486
5 changed files with 344 additions and 113 deletions

View File

@@ -1174,10 +1174,14 @@ class SubEventsTest(SoupTest):
'rruleformset-0-end': 'count',
'rruleformset-0-count': '10',
'rruleformset-0-until': '2019-04-03',
'timeformset-TOTAL_FORMS': '1',
'timeformset-INITIAL_FORMS': '0',
'timeformset-MIN_NUM_FORMS': '1',
'timeformset-MAX_NUM_FORMS': '1000',
'timeformset-0-time_from': '13:29:31',
'timeformset-0-time_to': '15:29:31',
'name_0': 'Foo',
'active': 'on',
'time_from': '13:29:31',
'time_to': '15:29:31',
'location_0': 'Loc',
'time_admission': '',
'frontpage_text_0': '',
@@ -1262,10 +1266,14 @@ class SubEventsTest(SoupTest):
'rruleformset-0-end': 'until',
'rruleformset-0-count': '10',
'rruleformset-0-until': '2019-04-03',
'timeformset-TOTAL_FORMS': '1',
'timeformset-INITIAL_FORMS': '0',
'timeformset-MIN_NUM_FORMS': '1',
'timeformset-MAX_NUM_FORMS': '1000',
'timeformset-0-time_from': '13:29:31',
'timeformset-0-time_to': '15:29:31',
'name_0': 'Foo',
'active': 'on',
'time_from': '13:29:31',
'time_to': '15:29:31',
'frontpage_text_0': '',
'rel_presale_start_0': 'unset',
'rel_presale_start_1': '',
@@ -1277,10 +1285,13 @@ class SubEventsTest(SoupTest):
'rel_presale_end_2': '1',
'rel_presale_end_3': 'date_from',
'rel_presale_end_4': '13:29:31',
'quotas-TOTAL_FORMS': '0',
'quotas-TOTAL_FORMS': '1',
'quotas-INITIAL_FORMS': '0',
'quotas-MIN_NUM_FORMS': '0',
'quotas-MIN_NUM_FORMS': '1',
'quotas-MAX_NUM_FORMS': '1000',
'quotas-0-name': 'Q1',
'quotas-0-size': '50',
'quotas-0-itemvars': str(self.ticket.pk),
'checkinlist_set-TOTAL_FORMS': '0',
'checkinlist_set-INITIAL_FORMS': '0',
'checkinlist_set-MIN_NUM_FORMS': '0',
@@ -1295,6 +1306,74 @@ class SubEventsTest(SoupTest):
assert ses[110].date_from.isoformat() == "2018-11-09T12:29:31+00:00" # DST :)
assert ses[-1].date_from.isoformat() == "2019-04-02T11:29:31+00:00"
def test_create_bulk_daily_interval_multiple_times(self):
with scopes_disabled():
self.event1.subevents.all().delete()
self.event1.settings.timezone = 'Europe/Berlin'
doc = self.get_doc('/control/event/ccc/30c3/subevents/bulk_add')
assert doc.select("input[name=rruleformset-TOTAL_FORMS]")
doc = self.post_doc('/control/event/ccc/30c3/subevents/bulk_add', {
'rruleformset-TOTAL_FORMS': '1',
'rruleformset-INITIAL_FORMS': '0',
'rruleformset-MIN_NUM_FORMS': '0',
'rruleformset-MAX_NUM_FORMS': '1000',
'rruleformset-0-interval': '2',
'rruleformset-0-freq': 'daily',
'rruleformset-0-dtstart': '2018-04-03',
'rruleformset-0-yearly_same': 'on',
'rruleformset-0-yearly_bysetpos': '1',
'rruleformset-0-yearly_byweekday': 'MO',
'rruleformset-0-yearly_bymonth': '1',
'rruleformset-0-monthly_same': 'on',
'rruleformset-0-monthly_bysetpos': '1',
'rruleformset-0-monthly_byweekday': 'MO',
'rruleformset-0-end': 'until',
'rruleformset-0-count': '10',
'rruleformset-0-until': '2019-04-03',
'timeformset-TOTAL_FORMS': '2',
'timeformset-INITIAL_FORMS': '0',
'timeformset-MIN_NUM_FORMS': '1',
'timeformset-MAX_NUM_FORMS': '1000',
'timeformset-0-time_from': '13:29:31',
'timeformset-0-time_to': '15:29:31',
'timeformset-1-time_from': '15:29:31',
'timeformset-1-time_to': '17:29:31',
'name_0': 'Foo',
'active': 'on',
'frontpage_text_0': '',
'rel_presale_start_0': 'unset',
'rel_presale_start_1': '',
'rel_presale_start_2': '1',
'rel_presale_start_3': 'date_from',
'rel_presale_start_4': '',
'rel_presale_end_1': '',
'rel_presale_end_0': 'relative',
'rel_presale_end_2': '1',
'rel_presale_end_3': 'date_from',
'rel_presale_end_4': '13:29:31',
'quotas-TOTAL_FORMS': '1',
'quotas-INITIAL_FORMS': '0',
'quotas-MIN_NUM_FORMS': '0',
'quotas-MAX_NUM_FORMS': '1000',
'quotas-0-name': 'Q1',
'quotas-0-size': '50',
'quotas-0-itemvars': str(self.ticket.pk),
'checkinlist_set-TOTAL_FORMS': '0',
'checkinlist_set-INITIAL_FORMS': '0',
'checkinlist_set-MIN_NUM_FORMS': '0',
'checkinlist_set-MAX_NUM_FORMS': '1000',
})
assert doc.select(".alert-success")
with scopes_disabled():
ses = list(self.event1.subevents.order_by('date_from'))
assert len(ses) == 183 * 2
assert ses[0].date_from.isoformat() == "2018-04-03T11:29:31+00:00"
assert ses[1].date_from.isoformat() == "2018-04-03T13:29:31+00:00"
assert ses[220].date_from.isoformat() == "2018-11-09T12:29:31+00:00" # DST :)
assert ses[-1].date_from.isoformat() == "2019-04-02T13:29:31+00:00"
def test_create_bulk_exclude(self):
with scopes_disabled():
self.event1.subevents.all().delete()
@@ -1335,10 +1414,14 @@ class SubEventsTest(SoupTest):
'rruleformset-1-count': '10',
'rruleformset-1-until': '2019-04-03',
'rruleformset-1-exclude': 'on',
'timeformset-TOTAL_FORMS': '1',
'timeformset-INITIAL_FORMS': '0',
'timeformset-MIN_NUM_FORMS': '1',
'timeformset-MAX_NUM_FORMS': '1000',
'timeformset-0-time_from': '13:29:31',
'timeformset-0-time_to': '15:29:31',
'name_0': 'Foo',
'active': 'on',
'time_from': '13:29:31',
'time_to': '15:29:31',
'frontpage_text_0': '',
'rel_presale_start_0': 'unset',
'rel_presale_start_1': '',
@@ -1350,10 +1433,13 @@ class SubEventsTest(SoupTest):
'rel_presale_end_2': '1',
'rel_presale_end_3': 'date_from',
'rel_presale_end_4': '13:29:31',
'quotas-TOTAL_FORMS': '0',
'quotas-TOTAL_FORMS': '1',
'quotas-INITIAL_FORMS': '0',
'quotas-MIN_NUM_FORMS': '0',
'quotas-MAX_NUM_FORMS': '1000',
'quotas-0-name': 'Q1',
'quotas-0-size': '50',
'quotas-0-itemvars': str(self.ticket.pk),
'checkinlist_set-TOTAL_FORMS': '0',
'checkinlist_set-INITIAL_FORMS': '0',
'checkinlist_set-MIN_NUM_FORMS': '0',
@@ -1392,10 +1478,14 @@ class SubEventsTest(SoupTest):
'rruleformset-0-end': 'until',
'rruleformset-0-count': '10',
'rruleformset-0-until': '2019-04-03',
'timeformset-TOTAL_FORMS': '1',
'timeformset-INITIAL_FORMS': '0',
'timeformset-MIN_NUM_FORMS': '1',
'timeformset-MAX_NUM_FORMS': '1000',
'timeformset-0-time_from': '13:29:31',
'timeformset-0-time_to': '15:29:31',
'name_0': 'Foo',
'active': 'on',
'time_from': '13:29:31',
'time_to': '15:29:31',
'frontpage_text_0': '',
'rel_presale_start_0': 'unset',
'rel_presale_start_1': '',
@@ -1407,10 +1497,13 @@ class SubEventsTest(SoupTest):
'rel_presale_end_2': '1',
'rel_presale_end_3': 'date_from',
'rel_presale_end_4': '13:29:31',
'quotas-TOTAL_FORMS': '0',
'quotas-TOTAL_FORMS': '1',
'quotas-INITIAL_FORMS': '0',
'quotas-MIN_NUM_FORMS': '0',
'quotas-MAX_NUM_FORMS': '1000',
'quotas-0-name': 'Q1',
'quotas-0-size': '50',
'quotas-0-itemvars': str(self.ticket.pk),
'checkinlist_set-TOTAL_FORMS': '0',
'checkinlist_set-INITIAL_FORMS': '0',
'checkinlist_set-MIN_NUM_FORMS': '0',
@@ -1449,10 +1542,14 @@ class SubEventsTest(SoupTest):
'rruleformset-0-end': 'until',
'rruleformset-0-count': '10',
'rruleformset-0-until': '2019-04-03',
'timeformset-TOTAL_FORMS': '1',
'timeformset-INITIAL_FORMS': '0',
'timeformset-MIN_NUM_FORMS': '1',
'timeformset-MAX_NUM_FORMS': '1000',
'timeformset-0-time_from': '13:29:31',
'timeformset-0-time_to': '15:29:31',
'name_0': 'Foo',
'active': 'on',
'time_from': '13:29:31',
'time_to': '15:29:31',
'frontpage_text_0': '',
'rel_presale_start_0': 'unset',
'rel_presale_start_1': '',
@@ -1464,10 +1561,13 @@ class SubEventsTest(SoupTest):
'rel_presale_end_2': '1',
'rel_presale_end_3': 'date_from',
'rel_presale_end_4': '13:29:31',
'quotas-TOTAL_FORMS': '0',
'quotas-TOTAL_FORMS': '1',
'quotas-INITIAL_FORMS': '0',
'quotas-MIN_NUM_FORMS': '0',
'quotas-MAX_NUM_FORMS': '1000',
'quotas-0-name': 'Q1',
'quotas-0-size': '50',
'quotas-0-itemvars': str(self.ticket.pk),
'checkinlist_set-TOTAL_FORMS': '0',
'checkinlist_set-INITIAL_FORMS': '0',
'checkinlist_set-MIN_NUM_FORMS': '0',