Skip to content

Commit

Permalink
Add ZIP export for accepted MITS games
Browse files Browse the repository at this point in the history
Requested via Slack.
  • Loading branch information
kitsuta committed Nov 28, 2024
1 parent fcf4554 commit c23369a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions uber/site_sections/mits_admin.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import cherrypy
from pockets import sluggify
from pockets.autolog import log

from uber.config import c
from uber.decorators import ajax, all_renderable, csv_file
from uber.decorators import ajax, all_renderable, csv_file, multifile_zipfile
from uber.errors import HTTPRedirect
from uber.models import Attendee, MITSTeam
from uber.models import Attendee, MITSTeam, MITSGame
from uber.utils import add_opt, check_csrf


Expand Down Expand Up @@ -162,3 +163,11 @@ def panel_requests(self, out, session):
'available' if val in available else ''
for val, desc in c.MITS_SCHEDULE_OPTS
])

@multifile_zipfile
def accepted_games_images_zip(self, zip_file, session):
query = session.query(MITSGame).filter_by(has_been_accepted=True).outerjoin(MITSGame.pictures)

for game in query:
for pic in game.pictures:
zip_file.write(pic.filepath, sluggify(pic.game.name) + "_" + pic.filename)

0 comments on commit c23369a

Please sign in to comment.