Skip to content

Commit

Permalink
Fix how guest panels are handled
Browse files Browse the repository at this point in the history
We had very old data in the panel-related info of the guest checklist CSV. Also, panel_applications means applications ASSIGNED to someone as POC and not applications they have submitted. I added a new relationship for submitted apps and changed the guest plugin to rely on those, which should fix various display errors on the checklist.
  • Loading branch information
kitsuta committed Oct 11, 2024
1 parent ff124fe commit 5e1e2d5
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 24 deletions.
2 changes: 1 addition & 1 deletion uber/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ def access_query_matrix(self):

return_dict['panels_admin'] = self.query(Attendee).outerjoin(PanelApplicant).filter(
or_(Attendee.ribbon.contains(c.PANELIST_RIBBON),
Attendee.panel_applications != None, # noqa: E711
Attendee.submitted_panels != None, # noqa: E711
Attendee.assigned_panelists != None, # noqa: E711
Attendee.panel_applicants != None, # noqa: E711
Attendee.panel_feedback != None)) # noqa: E711
Expand Down
7 changes: 7 additions & 0 deletions uber/models/attendee.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,13 @@ class Attendee(MagModel, TakesPaymentMixin):
panel_applicants = relationship('PanelApplicant', backref='attendee')
panel_applications = relationship('PanelApplication', backref='poc')
panel_feedback = relationship('EventFeedback', backref='attendee')
submitted_panels = relationship(
'PanelApplication',
secondary='panel_applicant',
secondaryjoin='and_(PanelApplicant.app_id == PanelApplication.id)',
primaryjoin='and_(Attendee.id == PanelApplicant.attendee_id, PanelApplicant.submitter == True)',
viewonly=True
)

# =========================
# attractions
Expand Down
4 changes: 2 additions & 2 deletions uber/models/guests.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ def merch_status(self):

@property
def panel_status(self):
application_count = len(self.group.leader.panel_applications)
application_count = len(self.group.leader.submitted_panels)
return '{} Panel Application(s)'.format(application_count) \
if self.group.leader.panel_applications else self.status('panel')
if self.group.leader.submitted_panels else self.status('panel')

@property
def mc_status(self):
Expand Down
28 changes: 24 additions & 4 deletions uber/site_sections/guest_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ def checklist_info_csv(self, out, session):
for guest in [guest for guest in session.query(GuestGroup).all() if session.admin_can_see_guest_group(guest)]:
absolute_pic_url = convert_to_absolute_url(getattr(guest.bio, 'pic_url', ''))
absolute_stageplot_url = convert_to_absolute_url(getattr(guest.stage_plot, 'url', ''))
num_panels = 0 if not guest.group or not guest.group.leader or not guest.group.leader.submitted_panels \
else len(guest.group.leader.submitted_panels)

out.writerow([
guest.group_type_label, guest.group.name, guest.email,
guest.payment, guest.vehicles, guest.num_hotel_rooms,
Expand All @@ -49,10 +52,7 @@ def checklist_info_csv(self, out, session):
getattr(guest.bio, 'twitter', ''), getattr(guest.bio, 'instagram', ''),
getattr(guest.bio, 'twitch', ''), getattr(guest.bio, 'bandcamp', ''),
getattr(guest.bio, 'discord', ''), getattr(guest.bio, 'other_social_media', ''),
getattr(guest.bio, 'pic_filename', ''), absolute_pic_url,
getattr(guest.panel, 'wants_panel', ''), getattr(guest.panel, 'name', ''),
getattr(guest.panel, 'length', ''), getattr(guest.panel, 'desc', ''),
' / '.join(getattr(guest.panel, 'panel_tech_needs_labels', '')),
getattr(guest.bio, 'pic_filename', ''), absolute_pic_url, num_panels,
getattr(guest.autograph, 'num', ''), getattr(guest.autograph, 'length', ''),
getattr(guest.autograph, 'rock_island_autographs', ''), getattr(guest.autograph,
'rock_island_length', ''),
Expand All @@ -78,6 +78,26 @@ def detailed_travel_info_csv(self, out, session):
time_day_local(plan.departure_time), plan.departure_details,
plan.extra_details])
out.writerow(content_row)

@csv_file
def panel_info_csv(self, out, session):
out.writerow(['Guest', 'App Status', 'Name', 'Description', 'Schedule Description', 'Length',
'Department', 'Type of Panel', 'Location', 'Date/Time'])
for guest in session.query(GuestGroup):
if guest.group and guest.group.leader:
for app in guest.group.leader.submitted_panels:
out.writerow([
guest.group.name, app.status_label,
getattr(app.event, 'name', app.name),
getattr(app.event, 'description', app.description),
getattr(app.event, 'public_description', app.public_description),
f"{app.event.minutes} minutes" if app.event else f"{app.length_label} (expected)",
app.department_label,
app.other_presentation if app.presentation == c.OTHER else app.presentation_label,
getattr(app.event, 'location_label', '(not scheduled)'),
app.event.timespan(minute_increment=30) if app.event else '(not scheduled)',
])


@site_mappable
def rock_island(self, session, message='', only_empty=None, id=None, **params):
Expand Down
2 changes: 1 addition & 1 deletion uber/site_sections/panels_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def everything(self, out, session):
out.writerow([
app.name,
app.description,
app.length,
app.length_label,
app.unavailable,
app.past_attendance,
app.affiliations,
Expand Down
1 change: 1 addition & 0 deletions uber/templates/group_admin/guests.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@
<p><a href="../guest_reports/checklist_info_csv">Export all checklist data as a CSV file</a></p>
<p><a href="../guest_reports/autograph_requests">Autographs CSV</a></p>
<p><a href="../guest_reports/detailed_travel_info_csv">Detailed Travel Info CSV</a></p>
<p><a href="../guest_reports/panel_info_csv">Submitted Panels CSV</a></p>
{% endif %}
6 changes: 3 additions & 3 deletions uber/templates/guest_admin/checklist_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ <h2>Guest Info for <a href="../guests/index?id={{ guest.id }}">{{ guest.group.na
{{ csrf_token() }}
<input type="hidden" name="id" value="{{ guest.id }}" />

{% if guest.group.leader.panel_applications %}
{% if guest.group.leader.submitted_panels %}
<div class="form-group">
<label class="col-sm-3 control-label">Panels</label>
<div class="col-sm-6">
<div class="form-control-static">
<a href="../panels_admin/assigned_to?id={{ guest.group.leader.id }}" target="_blank">
View the {{ guest.group.leader.panel_applications|length }}
panel{{ guest.group.leader.panel_applications|length|pluralize }} submitted by this guest.
View the {{ guest.group.leader.submitted_panels|length }}
panel{{ guest.group.leader.submitted_panels|length|pluralize }} submitted by this guest.
</a>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions uber/templates/guest_checklist/band_panel_deadline.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% extends "guest_checklist/panel_deadline.html" %}

{% block deadline_text %}
{% if not guest.group.leader.panel_applications %}
{% if not guest.group.leader.submitted_panels %}
Are you interested in running a panel at MAGFest? Please tell us what you would like to plan and
our panels department will get in touch with more details.
{% else %}
You have already submitted {{ guest.group.leader.panel_applications|length }} panel
idea{{ guest.group.leader.panel_applications|length|pluralize }}.
You have already submitted {{ guest.group.leader.submitted_panels|length }} panel
idea{{ guest.group.leader.submitted_panels|length|pluralize }}.
{% if c.APP_LIMIT %}
You may submit up to {{ c.APP_LIMIT }} panels for review.
{% endif %}
Expand Down
6 changes: 3 additions & 3 deletions uber/templates/guest_checklist/guest_panel_deadline.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
{% block deadline_headline %}Add Your Panels{% endblock %}

{% block deadline_text %}
{% if not guest.group.leader.panel_applications %}
{% if not guest.group.leader.submitted_panels %}
What panels and/or events are you hosting at {{ c.EVENT_NAME }}? Please submit an application for each.
{% else %}
You have already submitted {{ guest.group.leader.panel_applications|length }} panel/event
idea{{ guest.group.leader.panel_applications|length|pluralize }}.
You have already submitted {{ guest.group.leader.submitted_panels|length }} panel/event
idea{{ guest.group.leader.submitted_panels|length|pluralize }}.
{% if c.APP_LIMIT %}
You may submit up to {{ c.APP_LIMIT }} applications for review.
{% endif %}
Expand Down
6 changes: 3 additions & 3 deletions uber/templates/guest_checklist/panel_deadline.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<tr>
<td colspan="3">
{% block deadline_text %}
{% if not guest.group.leader.panel_applications %}
{% if not guest.group.leader.submitted_panels %}
What panels and/or events are you putting on at {{ c.EVENT_NAME }}? Please use the above link to submit each panel.
{% else %}
You have already submitted {{ guest.group.leader.panel_applications|length }} panel
idea{{ guest.group.leader.panel_applications|length|pluralize }}.
You have already submitted {{ guest.group.leader.submitted_panels|length }} panel
idea{{ guest.group.leader.submitted_panels|length|pluralize }}.
{% if c.APP_LIMIT %}
You may submit up to {{ c.APP_LIMIT }} panels for review.
{% endif %}
Expand Down
8 changes: 4 additions & 4 deletions uber/templates/panels/guest.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@

<div class="panel">
<div class="panel-body">
{% if c.APP_LIMIT and attendee.panel_applications|length >= c.APP_LIMIT %}
{% if c.APP_LIMIT and attendee.submitted_panels|length >= c.APP_LIMIT %}
You have already submitted the maximum number of panels ({{ c.APP_LIMIT }}). Please contact your liaison if
you need to change a panel or submit more ideas.

<br/><br/><a href="{{ return_to }}" class="btn btn-primary">Go Back</a>
{% else %}
{% if c.APP_LIMIT %}
You may submit up to {{ c.APP_LIMIT }} panel ideas.
{% if attendee.panel_applications %}
You have already submitted {{ attendee.panel_applications|length }}.
{% if attendee.submitted_panels %}
You have already submitted {{ attendee.submitted_panels|length }}.
{% endif %}
{% endif %}
<form method="post" action="guest" class="form-horizontal" role="form">
Expand Down Expand Up @@ -57,7 +57,7 @@ <h3>Other Panelists</h3>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-3">
<button type="submit" class="btn btn-primary">Submit Panel Idea</button>
{% if not c.APP_LIMIT or attendee.panel_applications|length < c.APP_LIMIT %}
{% if not c.APP_LIMIT or attendee.submitted_panels|length < c.APP_LIMIT %}
<button type="submit" name="ignore_return_to" value="1" class="btn btn-success">Submit and Add Another Panel</button>
{% endif %}
</div>
Expand Down

0 comments on commit 5e1e2d5

Please sign in to comment.