From 7638212a50e294c085a476c8173253bdc94ef34a Mon Sep 17 00:00:00 2001 From: James Addison Date: Sun, 21 Jan 2024 13:01:42 +0000 Subject: [PATCH 1/3] testing: update volunteer shift test data for Y2024 --- apps/base/dev/tasks.py | 200 +++++++++++++++++++++-------------------- 1 file changed, 101 insertions(+), 99 deletions(-) diff --git a/apps/base/dev/tasks.py b/apps/base/dev/tasks.py index 0addc35a3..af0a5593c 100644 --- a/apps/base/dev/tasks.py +++ b/apps/base/dev/tasks.py @@ -1,6 +1,6 @@ """ Development CLI tasks """ import click -from pendulum import parse +from pendulum import DateTime, Duration as Offset from flask import current_app as app from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound @@ -189,19 +189,20 @@ def volunteer_data(): def volunteer_shifts(): """Make fake volunteer shifts""" # First = first start time. Final = end of last shift + start_date = DateTime(2024, 5, 30) shift_list = { # 'Tent' roles "Badge Helper": { "Badge Tent": [ { - "first": "2022-06-04 10:00:00", - "final": "2022-06-04 16:00:00", + "first": Offset(days=2, hours=10), + "final": Offset(days=2, hours=16), "min": 1, "max": 2, }, { - "first": "2022-06-05 10:00:00", - "final": "2022-06-05 16:00:00", + "first": Offset(days=3, hours=10), + "final": Offset(days=3, hours=16), "min": 1, "max": 2, }, @@ -210,32 +211,32 @@ def volunteer_shifts(): "Car Parking": { "Car Park": [ { - "first": "2022-06-02 08:00:00", - "final": "2022-06-02 20:00:00", + "first": Offset(hours=8), + "final": Offset(hours=20), "min": 1, "max": 3, }, { - "first": "2022-06-03 08:00:00", - "final": "2022-06-03 20:00:00", + "first": Offset(days=1, hours=8), + "final": Offset(days=1, hours=20), "min": 1, "max": 3, }, { - "first": "2022-06-04 10:00:00", - "final": "2022-06-04 16:00:00", + "first": Offset(days=2, hours=10), + "final": Offset(days=2, hours=16), "min": 1, "max": 1, }, { - "first": "2022-06-05 14:00:00", - "final": "2022-06-05 20:00:00", + "first": Offset(days=3, hours=14), + "final": Offset(days=3, hours=20), "min": 1, "max": 1, }, { - "first": "2022-06-06 08:00:00", - "final": "2022-06-06 12:00:00", + "first": Offset(days=4, hours=8), + "final": Offset(days=4, hours=12), "min": 1, "max": 3, }, @@ -244,32 +245,32 @@ def volunteer_shifts(): "Catering": { "Volunteer Tent": [ { - "first": "2022-06-02 07:00:00", - "final": "2022-06-02 20:00:00", + "first": Offset(hours=7), + "final": Offset(hours=20), "min": 2, "max": 5, }, { - "first": "2022-06-03 07:00:00", - "final": "2022-06-03 20:00:00", + "first": Offset(days=1, hours=7), + "final": Offset(days=1, hours=20), "min": 2, "max": 5, }, { - "first": "2022-06-04 07:00:00", - "final": "2022-06-04 20:00:00", + "first": Offset(days=2, hours=7), + "final": Offset(days=2, hours=20), "min": 2, "max": 5, }, { - "first": "2022-06-05 07:00:00", - "final": "2022-06-05 20:00:00", + "first": Offset(days=3, hours=7), + "final": Offset(days=3, hours=20), "min": 2, "max": 5, }, { - "first": "2022-06-06 07:00:00", - "final": "2022-06-06 20:00:00", + "first": Offset(days=4, hours=7), + "final": Offset(days=4, hours=20), "min": 2, "max": 5, }, @@ -278,8 +279,8 @@ def volunteer_shifts(): "Entrance Steward": { "Entrance": [ { - "first": "2022-06-02 08:00:00", - "final": "2022-06-06 12:00:00", + "first": Offset(hours=8), + "final": Offset(days=4, hours=12), "min": 2, "max": 4, } @@ -288,26 +289,26 @@ def volunteer_shifts(): "Games Master": { "Stage A": [ { - "first": "2022-06-02 20:00:00", - "final": "2022-06-02 23:00:00", + "first": Offset(hours=20), + "final": Offset(hours=23), "min": 1, "max": 3, }, { - "first": "2022-06-03 20:00:00", - "final": "2022-06-03 23:00:00", + "first": Offset(days=1, hours=20), + "final": Offset(days=1, hours=23), "min": 1, "max": 3, }, { - "first": "2022-06-04 20:00:00", - "final": "2022-06-04 23:00:00", + "first": Offset(days=2, hours=20), + "final": Offset(days=2, hours=23), "min": 1, "max": 3, }, { - "first": "2022-06-05 20:00:00", - "final": "2022-06-05 23:00:00", + "first": Offset(days=3, hours=20), + "final": Offset(days=3, hours=23), "min": 1, "max": 3, }, @@ -316,20 +317,20 @@ def volunteer_shifts(): "Green Room": { "Green Room": [ { - "first": "2022-06-03 12:00:00", - "final": "2022-06-04 00:00:00", + "first": Offset(days=1, hours=12), + "final": Offset(days=2, hours=0), "min": 1, "max": 1, }, { - "first": "2022-06-04 10:00:00", - "final": "2022-06-05 00:00:00", + "first": Offset(days=2, hours=10), + "final": Offset(days=3, hours=0), "min": 1, "max": 1, }, { - "first": "2022-06-05 10:00:00", - "final": "2022-06-05 20:00:00", + "first": Offset(days=3, hours=10), + "final": Offset(days=3, hours=20), "min": 1, "max": 1, }, @@ -338,32 +339,32 @@ def volunteer_shifts(): "Info Desk": { "Info Desk": [ { - "first": "2022-06-02 10:00:00", - "final": "2022-06-02 20:00:00", + "first": Offset(hours=10), + "final": Offset(hours=20), "min": 1, "max": 1, }, { - "first": "2022-06-03 10:00:00", - "final": "2022-06-03 20:00:00", + "first": Offset(days=1, hours=10), + "final": Offset(days=1, hours=20), "min": 1, "max": 1, }, { - "first": "2022-06-03 10:00:00", - "final": "2022-06-03 20:00:00", + "first": Offset(days=1, hours=10), + "final": Offset(days=1, hours=20), "min": 1, "max": 1, }, { - "first": "2022-06-04 10:00:00", - "final": "2022-06-04 20:00:00", + "first": Offset(days=2, hours=10), + "final": Offset(days=2, hours=20), "min": 1, "max": 1, }, { - "first": "2022-06-05 10:00:00", - "final": "2022-06-05 20:00:00", + "first": Offset(days=3, hours=10), + "final": Offset(days=3, hours=20), "min": 1, "max": 1, }, @@ -372,26 +373,26 @@ def volunteer_shifts(): "Tent Steward": { "N/A": [ { - "first": "2022-06-02 13:00:00", - "final": "2022-06-02 19:00:00", + "first": Offset(hours=13), + "final": Offset(hours=19), "min": 1, "max": 1, }, { - "first": "2022-06-03 13:00:00", - "final": "2022-06-03 19:00:00", + "first": Offset(days=1, hours=13), + "final": Offset(days=1, hours=19), "min": 1, "max": 1, }, { - "first": "2022-06-04 10:00:00", - "final": "2022-06-04 19:00:00", + "first": Offset(days=2, hours=10), + "final": Offset(days=2, hours=19), "min": 1, "max": 1, }, { - "first": "2022-06-05 10:00:00", - "final": "2022-06-05 19:00:00", + "first": Offset(days=3, hours=10), + "final": Offset(days=3, hours=19), "min": 1, "max": 1, }, @@ -400,26 +401,26 @@ def volunteer_shifts(): "Youth Workshop Helper": { "Youth Workshop": [ { - "first": "2022-06-02 13:00:00", - "final": "2022-06-02 20:00:00", + "first": Offset(hours=13), + "final": Offset(hours=20), "min": 1, "max": 2, }, { - "first": "2022-06-03 13:00:00", - "final": "2022-06-03 20:00:00", + "first": Offset(days=1, hours=13), + "final": Offset(days=1, hours=20), "min": 1, "max": 2, }, { - "first": "2022-06-04 09:00:00", - "final": "2022-06-04 20:00:00", + "first": Offset(days=2, hours=9), + "final": Offset(days=2, hours=20), "min": 1, "max": 2, }, { - "first": "2022-06-05 09:00:00", - "final": "2022-06-05 20:00:00", + "first": Offset(days=3, hours=9), + "final": Offset(days=3, hours=20), "min": 1, "max": 2, }, @@ -429,46 +430,46 @@ def volunteer_shifts(): "Bar": { "Bar": [ { - "first": "2022-06-02 11:00:00", - "final": "2022-06-03 02:00:00", + "first": Offset(hours=11), + "final": Offset(days=1, hours=2), "min": 2, "max": 5, }, { - "first": "2022-06-03 11:00:00", - "final": "2022-06-04 02:00:00", + "first": Offset(days=1, hours=11), + "final": Offset(days=2, hours=2), "min": 2, "max": 5, }, { - "first": "2022-06-04 11:00:00", - "final": "2022-06-05 02:00:00", + "first": Offset(days=2, hours=11), + "final": Offset(days=3, hours=2), "min": 2, "max": 5, }, { - "first": "2022-06-05 11:00:00", - "final": "2022-06-06 01:00:00", + "first": Offset(days=3, hours=11), + "final": Offset(days=4, hours=1), "min": 2, "max": 5, }, ], "Bar 2": [ { - "first": "2022-06-03 20:00:00", - "final": "2022-06-04 01:00:00", + "first": Offset(days=1, hours=20), + "final": Offset(days=2, hours=1), "min": 1, "max": 2, }, { - "first": "2022-06-04 17:00:00", - "final": "2022-06-05 01:00:00", + "first": Offset(days=2, hours=17), + "final": Offset(days=3, hours=1), "min": 1, "max": 2, }, { - "first": "2022-06-05 17:00:00", - "final": "2022-06-06 00:00:00", + "first": Offset(days=3, hours=17), + "final": Offset(days=4, hours=0), "min": 1, "max": 2, }, @@ -477,26 +478,26 @@ def volunteer_shifts(): "NOC": { "N/A": [ { - "first": "2022-06-02 08:00:00", - "final": "2022-06-02 20:00:00", + "first": Offset(hours=8), + "final": Offset(hours=20), "min": 1, "max": 2, }, { - "first": "2022-06-03 08:00:00", - "final": "2022-06-03 20:00:00", + "first": Offset(days=1, hours=8), + "final": Offset(days=1, hours=20), "min": 1, "max": 2, }, { - "first": "2022-06-05 14:00:00", - "final": "2022-06-05 20:00:00", + "first": Offset(days=3, hours=14), + "final": Offset(days=3, hours=20), "min": 1, "max": 2, }, { - "first": "2022-06-06 08:00:00", - "final": "2022-06-06 12:00:00", + "first": Offset(days=4, hours=8), + "final": Offset(days=4, hours=12), "min": 1, "max": 2, }, @@ -505,26 +506,26 @@ def volunteer_shifts(): "Volunteer Manager": { "Volunteer Tent": [ { - "first": "2022-06-02 11:00:00", - "final": "2022-06-02 21:00:00", + "first": Offset(hours=11), + "final": Offset(hours=21), "min": 1, "max": 1, }, { - "first": "2022-06-03 11:00:00", - "final": "2022-06-03 21:00:00", + "first": Offset(days=1, hours=11), + "final": Offset(days=1, hours=21), "min": 1, "max": 1, }, { - "first": "2022-06-04 09:00:00", - "final": "2022-06-04 21:00:00", + "first": Offset(days=2, hours=9), + "final": Offset(days=2, hours=21), "min": 1, "max": 1, }, { - "first": "2022-06-05 09:00:00", - "final": "2022-06-05 21:00:00", + "first": Offset(days=3, hours=9), + "final": Offset(days=3, hours=21), "min": 1, "max": 1, }, @@ -546,10 +547,11 @@ def volunteer_shifts(): shifts = Shift.generate_for( role=role, venue=venue, - first=parse(shift_ranges["first"]), - final=parse(shift_ranges["final"]), + first=start_date + shift_ranges["first"], + final=start_date + shift_ranges["final"], min=shift_ranges["min"], max=shift_ranges["max"], + changeover=0, ) for s in shifts: db.session.add(s) From 70e18a2aceace53138739568b101ec652b3b916b Mon Sep 17 00:00:00 2001 From: James Addison Date: Sun, 21 Jan 2024 13:10:43 +0000 Subject: [PATCH 2/3] config: update development-example.cfg --- config/development-example.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/development-example.cfg b/config/development-example.cfg index 2d1b6e0d6..21a6c9326 100644 --- a/config/development-example.cfg +++ b/config/development-example.cfg @@ -81,9 +81,9 @@ CONTENT_IRC_CHANNEL = '#emfcamp-content' RESERVE_LIST_TICKET_LINK = "fill in a reserve list ticket link" # When updating these update/hide times in about/arrival-times.html -SALES_START = '2021-12-25 00:00:00' -EVENT_START = '2022-06-02 11:00:00' -EVENT_END = '2022-06-05 19:00:00' +SALES_START = '2024-02-01 00:00:00' +EVENT_START = '2024-05-30 11:00:00' +EVENT_END = '2024-05-30 19:00:00' DEFAULT_FLOW = 'main' From f467eff9c07cdb4bb79e2906b61bbe4a915bb7c5 Mon Sep 17 00:00:00 2001 From: James Addison Date: Sun, 21 Jan 2024 13:15:24 +0000 Subject: [PATCH 3/3] testing: read volunteer shift test data offset from config --- apps/base/dev/tasks.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/base/dev/tasks.py b/apps/base/dev/tasks.py index af0a5593c..b96b67fea 100644 --- a/apps/base/dev/tasks.py +++ b/apps/base/dev/tasks.py @@ -1,6 +1,6 @@ """ Development CLI tasks """ import click -from pendulum import DateTime, Duration as Offset +from pendulum import Duration as Offset, parse from flask import current_app as app from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound @@ -189,7 +189,12 @@ def volunteer_data(): def volunteer_shifts(): """Make fake volunteer shifts""" # First = first start time. Final = end of last shift - start_date = DateTime(2024, 5, 30) + start_date = parse(app.config["EVENT_START"]).set( + hour=0, + minute=0, + second=0, + microsecond=0, + ) shift_list = { # 'Tent' roles "Badge Helper": {