-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add wants_visualist to band checklist
Also updates the date for the shifts_worked email.
- Loading branch information
Showing
4 changed files
with
77 additions
and
7 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
alembic/versions/60318045a6fe_add_wants_visualist_to_band_checklist.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
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] | ||
|
||
|
||
@Session.model_mixin | ||
class GuestMerch: | ||
extra_merch_time = Column(MultiChoice(c.EXTRA_MERCH_TIME_OPTS)) | ||
extra_merch_time = Column(MultiChoice(c.EXTRA_MERCH_TIME_OPTS)) | ||
|
||
@Session.model_mixin | ||
class GuestStagePlot: | ||
wants_visualist = Column(Boolean, default=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters