Skip to content

Commit

Permalink
Merge pull request #1044 from hotosm/hotfix
Browse files Browse the repository at this point in the history
hotfix: calculate max last_submission only if valid_datetimes present
  • Loading branch information
nrjadkry authored Dec 14, 2023
2 parents c66f04c + f07aec2 commit c25d6fd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/backend/app/submission/submission_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,13 @@ def update_submission_in_s3(
for form in odk_forms
if form["lastSubmission"] is not None
]
last_submission = max(
valid_datetimes, key=lambda x: datetime.strptime(x, "%Y-%m-%dT%H:%M:%S.%fZ")
last_submission = (
max(
valid_datetimes,
key=lambda x: datetime.strptime(x, "%Y-%m-%dT%H:%M:%S.%fZ"),
)
if valid_datetimes
else None
)

# Check if the file already exists in s3
Expand Down

0 comments on commit c25d6fd

Please sign in to comment.