Skip to content

Commit

Permalink
Update Panels for Super 2025
Browse files Browse the repository at this point in the history
Fixes https://jira.magfest.net/browse/MAGDEV-1318 and also stops setting the livestream/record option to 'yes' by default.
  • Loading branch information
kitsuta committed Aug 8, 2024
1 parent bec0bb2 commit 18e20d8
Show file tree
Hide file tree
Showing 17 changed files with 217 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
"""Add schedule description and separate recording preference option for panels
Revision ID: 0ba9060b0434
Revises: 983af01225fc
Create Date: 2024-08-08 03:37:03.691021
"""


# revision identifiers, used by Alembic.
revision = '0ba9060b0434'
down_revision = '983af01225fc'
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('event', sa.Column('public_description', sa.Unicode(), server_default='', nullable=False))
op.add_column('panel_application', sa.Column('public_description', sa.Unicode(), server_default='', nullable=False))
op.add_column('panel_application', sa.Column('record', sa.Integer(), server_default='227291107', nullable=False))


def downgrade():
op.drop_column('panel_application', 'record')
op.drop_column('panel_application', 'public_description')
op.drop_column('event', 'public_description')
2 changes: 1 addition & 1 deletion uber/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ def schedule(self):
'start_unix': int(mktime(event.start_time.utctimetuple())),
'end_unix': int(mktime(event.end_time.utctimetuple())),
'duration': event.minutes,
'description': event.description,
'description': event.public_description or event.description,
'panelists': [panelist.attendee.full_name for panelist in event.assigned_panelists]
}
for event in sorted(session.query(Event).all(), key=lambda e: [e.start_time, e.location_label])
Expand Down
2 changes: 0 additions & 2 deletions uber/configspec.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1724,8 +1724,6 @@ other = string(default="Other")

[[livestream]]
opt_in = string(default="It's fine to record or livestream this panel")
record_only = string(default="Recording for the public is okay, but not livestreaming")
private_record = string(default="Recording is okay, but please don't post it publicly")
opt_out = string(default="Please don't record or livestream this panel")

[[panel_app_status]]
Expand Down
13 changes: 13 additions & 0 deletions uber/model_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,19 @@ def specify_nonstandard_time(app):
return 'Please explain why your panel needs to be longer than sixty minutes.'


@validation.PanelApplication
def select_livestream_opt(app):
if not app.livestream:
return 'Please select your preference for recording/livestreaming.' \
if len(c.LIVESTREAM_OPTS) > 2 else 'Please tell us if we can livestream your panel.'


@validation.PanelApplication
def select_record_opt(app):
if not app.record and len(c.LIVESTREAM_OPTS) <= 2:
return 'Please tell us if we can record your panel.'


@validation.PanelApplication
def specify_table_needs(app):
if app.need_tables and not app.tables_desc:
Expand Down
12 changes: 11 additions & 1 deletion uber/models/panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Event(MagModel):
duration = Column(Integer) # half-hour increments
name = Column(UnicodeText, nullable=False)
description = Column(UnicodeText)
public_description = Column(UnicodeText)

assigned_panelists = relationship('AssignedPanelist', backref='event')
applications = relationship('PanelApplication', backref=backref('event', cascade="save-update,merge"),
Expand Down Expand Up @@ -73,7 +74,8 @@ def guidebook_desc(self):
panelists_creds = '<br/><br/>' + '<br/><br/>'.join(
a.other_credentials for a in self.applications[0].applicants if a.other_credentials
) if self.applications else ''
return self.description + panelists_creds
description = self.public_description or self.description
return description + panelists_creds

@property
def guidebook_location(self):
Expand Down Expand Up @@ -104,6 +106,7 @@ class PanelApplication(MagModel):
length_text = Column(UnicodeText)
length_reason = Column(UnicodeText)
description = Column(UnicodeText)
public_description = Column(UnicodeText)
unavailable = Column(UnicodeText)
available = Column(UnicodeText)
affiliations = Column(UnicodeText)
Expand All @@ -123,6 +126,7 @@ class PanelApplication(MagModel):
tabletop = Column(Boolean, default=False)
cost_desc = Column(UnicodeText)
livestream = Column(Choice(c.LIVESTREAM_OPTS), default=c.OPT_IN)
record = Column(Choice(c.LIVESTREAM_OPTS), default=c.OPT_IN)
panelist_bringing = Column(UnicodeText)
extra_info = Column(UnicodeText)
applied = Column(UTCDateTime, server_default=utcnow(), default=lambda: datetime.now(UTC))
Expand All @@ -141,12 +145,18 @@ def update_event_info(self):
if self.event:
self.event.name = self.name
self.event.description = self.description
self.event.public_description = self.public_description

@presave_adjustment
def set_default_dept(self):
if len(c.PANEL_DEPT_OPTS) <= 1 and not self.department:
self.department = c.PANELS

@presave_adjustment
def set_record(self):
if len(c.LIVESTREAM_OPTS) > 2 and not self.record:
self.record = c.OPT_OUT

@property
def email(self):
return self.submitter and self.submitter.email
Expand Down
11 changes: 6 additions & 5 deletions uber/site_sections/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def schedule_tsv(self, session):
'date': event.start_time_local.strftime('%m/%d/%Y'),
'start_time': event.start_time_local.strftime('%I:%M:%S %p'),
'end_time': (event.start_time_local + timedelta(minutes=event.minutes)).strftime('%I:%M:%S %p'),
'description': normalize_newlines(event.description).replace('\n', ' ')
'description': normalize_newlines(event.public_description or event.description).replace('\n', ' '),
}))

return render('schedule/schedule.tsv', {
Expand Down Expand Up @@ -132,7 +132,7 @@ def ical(self, session, **params):
name=event.name,
begin=event.start_time,
end=(event.start_time + timedelta(minutes=event.minutes)),
description=normalize_newlines(event.description),
description=normalize_newlines(event.public_description or event.description),
created=event.created_info.when,
location=event.location_label))

Expand Down Expand Up @@ -160,7 +160,7 @@ def csv(self, out, session):
(event.start_time_local + timedelta(minutes=event.minutes)).strftime('%I:%M:%S %p'),
event.location_label,
event.guidebook_track,
normalize_newlines(event.description).replace('\n', ' '),
normalize_newlines(event.public_description or event.description).replace('\n', ' '),
'', '', '', ''
])
for r in sorted(rows, key=lambda tup: tup[4]):
Expand All @@ -179,7 +179,7 @@ def panels(self, out, session):
event.start_time_local.strftime('%I%p %a').lstrip('0'),
'{} minutes'.format(event.minutes),
event.location_label,
event.description,
event.public_description or event.description,
panelist_names])

@schedule_view
Expand All @@ -194,7 +194,7 @@ def panels_json(self, session):
'start_unix': int(mktime(event.start_time.utctimetuple())),
'end_unix': int(mktime(event.end_time.utctimetuple())),
'duration': event.minutes,
'description': event.description,
'description': event.public_description or event.description,
'panelists': [panelist.attendee.full_name for panelist in event.assigned_panelists]
}
for event in sorted(session.query(Event).all(), key=lambda e: [e.start_time, e.location_label])
Expand Down Expand Up @@ -243,6 +243,7 @@ def form(self, session, message='', panelists=(), **params):
if event.is_new:
event.name = add_panel.name
event.description = add_panel.description
event.public_description = add_panel.public_description
for pa in add_panel.applicants:
if pa.attendee_id:
assigned_panelist = AssignedPanelist(attendee_id=pa.attendee.id, event_id=event.id)
Expand Down
6 changes: 6 additions & 0 deletions uber/templates/emails/panels/application.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<li><strong>Department</strong>: {{ app.department_label }}</li>
<li><strong>Type</strong>: {{ app.presentation_label }}{% if app.presentation == c.OTHER %} ({{ app.other_presentation }}){% endif %}</li>
<li><strong>Description</strong>: {{ app.description }}</li>
{% if app.public_description %}<li><strong>Schedule Description</strong>: {{ app.public_description }}</li>{% endif %}
{% if c.PANEL_RATING_OPTS|length > 1 %}<li><strong>Rating</strong>: {{ app.rating_label }}</li>{% endif %}
{% if c.PANEL_CONTENT_OPTS|length > 1 %}
<li><strong>Mature Content</strong>: {{ app.granular_rating_labels|join(', ') }}</li>
Expand All @@ -42,7 +43,12 @@
<li><strong>Expected Length</strong>: {{ app.length_label if app.length != c.OTHER and not app.length_text else app.length_text }}</li>
{% if app.length_reason %}<li><strong>Reason for Length</strong>: {{ app.length_reason }}</li>{% endif %}
<li><strong>Noise Level</strong>: {{ app.noise_level_label }}</li>
{% if c.LIVE_STREAM_OPTS|length > 2 %}
<li><strong>Recording or Livestreaming:</strong> {{ app.livestream_label }}</li>
{% else %}
<li><strong>Recording:</strong> {{ app.record_label }}</li>
<li><strong>Livestreaming:</strong> {{ app.livestream_label }}</li>
{% endif %}
{% if app.tables_desc %}<li><strong>Special Table Set-up</strong>: {{ app.tables_desc }}</li>{% endif %}
{% if app.cost_desc %}<li><strong>Upfront Cost and Materials</strong>: {{ app.cost_desc }}</li>{% endif %}
{% if app.available %}<li><strong>Availability</strong>: {{ app.available|linebreaksbr }}</li>{% endif %}
Expand Down
2 changes: 2 additions & 0 deletions uber/templates/mivs/show_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ <h4>Gameplay Images</h4>
</table>
<a class="btn btn-primary" href="screenshot?game_id={{ game.id }}&use_in_promo=True">Upload a Screenshot</a>

{# TODO: Add Guidebook image upload!! #}

<form method="post" enctype="multipart/form-data" class="form-horizontal" action="show_info">
{{ csrf_token() }}
<input type="hidden" name="id" value="{{ game.id }}" />
Expand Down
53 changes: 46 additions & 7 deletions uber/templates/panel_app_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">Department</label>
<div class="col-sm-6">
<select class="form-select" name="department">
<select class="form-control" name="department">
<option value="">Please select an option</option>
{{ options(c.PANEL_DEPT_OPTS, app.department) }}
</select>
Expand All @@ -81,7 +81,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">Panel Content Rating</label>
<div class="col-sm-6">
<select class="form-select" name="rating">
<select class="form-control" name="rating">
{{ options(c.PANEL_RATING_OPTS, app.rating) }}
</select>
</div>
Expand Down Expand Up @@ -119,7 +119,17 @@
</div>
<div class="clearfix"></div>
<p class="help-block col-sm-9 col-sm-offset-3">
Will appear as a subheading on the schedule. 200 words max. 18+ panels will not be accepted.
This is to explain your pitch to us - this can be different from what you want to show the public. <strong>18+ panels will not be accepted.</strong>
</p>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Schedule Description</label>
<div class="col-sm-6">
<textarea class="form-control" name="public_description" rows="4">{{ app.public_description }}</textarea>
</div>
<div class="clearfix"></div>
<p class="help-block col-sm-9 col-sm-offset-3">
To be shown on the public facing schedule. 200 words max. Leave blank if this is the same as the Panel Description.
</p>
</div>
{% if c.PANEL_CONTENT_OPTS|length > 1 %}
Expand All @@ -138,7 +148,7 @@
<div class="form-group">
<div class="col-sm-9 col-sm-offset-3">
<strong>Do you want your content to be highlighted by the MAGScouts program?</strong>
<select class="form-select" name="magscouts_opt_in">
<select class="form-control" name="magscouts_opt_in">
{{ options(c.PANEL_MAGSCOUTS_OPTS, app.magscouts_opt_in) }}
</select>
</div>
Expand Down Expand Up @@ -169,7 +179,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">Expected Panel Length</label>
<div class="col-sm-6">
<select class="form-select" name="length">
<select class="form-control" name="length">
{{ options(c.PANEL_LENGTH_OPTS, app.length) }}
</select>
</div>
Expand All @@ -195,17 +205,18 @@
<div class="form-group">
<label class="col-sm-3 control-label">Panel Noise Level</label>
<div class="col-sm-6">
<select class="form-select" name="noise_level">
<select class="form-control" name="noise_level">
<option value="">Please select an option</option>
{{ options(c.NOISE_LEVEL_OPTS, app.noise_level) }}
</select>
</div>
<div class="clearfix"></div>
</div>
{% if c.LIVE_STREAM_OPTS|length > 2 %}
<div class="form-group">
<label class="col-sm-3 control-label">Is it okay to record or livestream your panel? </label>
<div class="col-sm-6">
<select class="form-select" name="livestream">
<select class="form-control" name="livestream">
{{ options(c.LIVESTREAM_OPTS, app.livestream) }}
</select>
</div>
Expand All @@ -214,6 +225,34 @@
While we don't record/live stream every panel, we attempt to record and post most panels to our YouTube channel after the event.
</p>
</div>
{% else %}
<div class="form-group">
<label class="col-sm-3 control-label">Is it okay to record your panel? </label>
<div class="col-sm-6">
<select class="form-control" name="record">
<option value="">Please select an option</option>
{{ options(c.LIVESTREAM_OPTS, app.record) }}
</select>
</div>
<div class="clearfix"></div>
<p class="help-block col-sm-9 col-sm-offset-3">
While we don't record every panel, we attempt to record and post most panels to our YouTube channel after the event.
</p>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Is it okay to livestream your panel? </label>
<div class="col-sm-6">
<select class="form-control" name="livestream">
<option value="">Please select an option</option>
{{ options(c.LIVESTREAM_OPTS, app.livestream) }}
</select>
</div>
<div class="clearfix"></div>
<p class="help-block col-sm-9 col-sm-offset-3">
If you answered Yes to being livestreamed, please ensure that you're not presenting anything that could be considered copyright infringement.
</p>
</div>
{% endif %}


<div class="form-group">
Expand Down
Loading

0 comments on commit 18e20d8

Please sign in to comment.