From c6c6568bd33d62bf118a07bf6ddd34d03563c936 Mon Sep 17 00:00:00 2001 From: Victoria Earl Date: Thu, 13 Jun 2024 12:16:32 -0400 Subject: [PATCH] Add wants_visualist to band checklist Also updates the date for the shifts_worked email. --- ...e_add_wants_visualist_to_band_checklist.py | 59 +++++++++++++++++++ magwest/models.py | 12 ++-- .../emails/shifts/shifts_worked.html | 2 +- .../guest_checklist/stage_plot_deadline.html | 11 ++++ 4 files changed, 77 insertions(+), 7 deletions(-) create mode 100644 alembic/versions/60318045a6fe_add_wants_visualist_to_band_checklist.py diff --git a/alembic/versions/60318045a6fe_add_wants_visualist_to_band_checklist.py b/alembic/versions/60318045a6fe_add_wants_visualist_to_band_checklist.py new file mode 100644 index 0000000..ba8caa7 --- /dev/null +++ b/alembic/versions/60318045a6fe_add_wants_visualist_to_band_checklist.py @@ -0,0 +1,59 @@ +"""Add wants_visualist to band checklist + +Revision ID: 60318045a6fe +Revises: 3b31528fe2cb +Create Date: 2024-06-13 16:15:17.089746 + +""" + + +# revision identifiers, used by Alembic. +revision = '60318045a6fe' +down_revision = '3b31528fe2cb' +branch_labels = None +depends_on = None + +from alembic import op +import sqlalchemy as sa + + + +try: + is_sqlite = op.get_context().dialect.name == 'sqlite' +except Exception: + is_sqlite = False + +if is_sqlite: + op.get_context().connection.execute('PRAGMA foreign_keys=ON;') + utcnow_server_default = "(datetime('now', 'utc'))" +else: + utcnow_server_default = "timezone('utc', current_timestamp)" + +def sqlite_column_reflect_listener(inspector, table, column_info): + """Adds parenthesis around SQLite datetime defaults for utcnow.""" + if column_info['default'] == "datetime('now', 'utc')": + column_info['default'] = utcnow_server_default + +sqlite_reflect_kwargs = { + 'listeners': [('column_reflect', sqlite_column_reflect_listener)] +} + +# =========================================================================== +# HOWTO: Handle alter statements in SQLite +# +# def upgrade(): +# if is_sqlite: +# with op.batch_alter_table('table_name', reflect_kwargs=sqlite_reflect_kwargs) as batch_op: +# batch_op.alter_column('column_name', type_=sa.Unicode(), server_default='', nullable=False) +# else: +# op.alter_column('table_name', 'column_name', type_=sa.Unicode(), server_default='', nullable=False) +# +# =========================================================================== + + +def upgrade(): + op.add_column('guest_stage_plot', sa.Column('wants_visualist', sa.Boolean(), server_default='False', nullable=False)) + + +def downgrade(): + op.drop_column('guest_stage_plot', 'wants_visualist') diff --git a/magwest/models.py b/magwest/models.py index 57f66ff..3811255 100644 --- a/magwest/models.py +++ b/magwest/models.py @@ -1,14 +1,10 @@ -from uber.models import Session +from uber.models import Session, Boolean from uber.models.types import DefaultColumn as Column, MultiChoice from uber.config import c @Session.model_mixin class Attendee: - @property - def num_free_event_shirts(self): - return 1 if self.badge_type == c.STAFF_BADGE else self.volunteer_event_shirt_eligible - @property def approved_panel_apps(self): return [panel.name for panel in self.panel_applications if panel.status == c.ACCEPTED] @@ -16,4 +12,8 @@ def approved_panel_apps(self): @Session.model_mixin class GuestMerch: - extra_merch_time = Column(MultiChoice(c.EXTRA_MERCH_TIME_OPTS)) \ No newline at end of file + extra_merch_time = Column(MultiChoice(c.EXTRA_MERCH_TIME_OPTS)) + +@Session.model_mixin +class GuestStagePlot: + wants_visualist = Column(Boolean, default=False) \ No newline at end of file diff --git a/magwest/templates/emails/shifts/shifts_worked.html b/magwest/templates/emails/shifts/shifts_worked.html index 89d6994..d8f3223 100644 --- a/magwest/templates/emails/shifts/shifts_worked.html +++ b/magwest/templates/emails/shifts/shifts_worked.html @@ -16,7 +16,7 @@ {% if c.HOTELS_ENABLED %}

Remember, if you don't have at least {{ c.HOURS_FOR_REFUND }} weighted hours, you won't be eligible for a staff badge or hotel space for {{ c.EVENT_NAME }} {{ c.EPOCH|datetime_local("%Y")|int + 1 }}. If you don't have {{ c.HOURS_FOR_HOTEL_SPACE }} weighted hours and claimed hotel space this year, we will also be reviewing your eligibility for next event.{% endif %} -

If you have any issues with the shifts listed, please contact us before August 15 so that we can fix any issues that could impact your ability to staff{% if c.HOTELS_ENABLED %} or request hotel space{% endif %} next year. +

If you have any issues with the shifts listed, please contact us before October 31 so that we can fix any issues that could impact your ability to staff{% if c.HOTELS_ENABLED %} or request hotel space{% endif %} next year.
diff --git a/magwest/templates/guest_checklist/stage_plot_deadline.html b/magwest/templates/guest_checklist/stage_plot_deadline.html index 9a01d60..d23e5e9 100644 --- a/magwest/templates/guest_checklist/stage_plot_deadline.html +++ b/magwest/templates/guest_checklist/stage_plot_deadline.html @@ -28,3 +28,14 @@

Failure to provide exact stage directions may result in you not receiving the setup you expect or want. {% endblock %} + +{% block form_extra %} +
+
+ +
+
+{% endblock %} \ No newline at end of file