Skip to content

Commit

Permalink
fix: submission sync region
Browse files Browse the repository at this point in the history
  • Loading branch information
pjsier committed Dec 28, 2024
1 parent 76d75e6 commit ae06f5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def handle_submissions():
for region in ["detroit", "milwaukee"]:
app.logger.info(f"Syncing submissions to spreadsheet: {region}")
worksheet = get_submission_worksheet(region)
sync_submissions_spreadsheet(worksheet)
sync_submissions_spreadsheet(worksheet, region)
return ("", 200)


Expand Down
3 changes: 2 additions & 1 deletion api/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_submission_worksheet(region: str) -> gspread.Worksheet:
return client.open(sheet_name).worksheet("submissions")


def sync_submissions_spreadsheet(worksheet, since=None):
def sync_submissions_spreadsheet(worksheet, region, since=None):
if since is None:
since = datetime.now(pytz.timezone("America/Detroit")) - timedelta(days=3)
sheet_uuids = set(worksheet.col_values(1))
Expand All @@ -46,6 +46,7 @@ def sync_submissions_spreadsheet(worksheet, since=None):
for uuid in db.session.query(Submission.uuid)
.filter(
Submission.data["step"].astext == "submit",
Submission.data["region"].astext == region,
Submission.created_at >= since,
)
.all()
Expand Down

0 comments on commit ae06f5b

Please sign in to comment.