🏦 Database Change: convert created utc to datetimez for volunteer_janitor (#679)

This commit is contained in:
Viet Than 2023-08-25 01:00:09 -05:00 committed by GitHub
parent 3187a372fe
commit 4f8ba42738
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 11 deletions

View file

@ -51,7 +51,7 @@ def update_comment_badness(db, cid, diagnostics: bool = False):
# This probably does more SQL queries than it should
records = db.query(VolunteerJanitorRecord) \
.where(VolunteerJanitorRecord.comment_id == cid) \
.order_by(VolunteerJanitorRecord.recorded_utc)
.order_by(VolunteerJanitorRecord.recorded_datetimez)
user_has_pending = {}
earliest_submission = {}
@ -61,7 +61,7 @@ def update_comment_badness(db, cid, diagnostics: bool = False):
user_has_pending[rec.user_id] = True
else:
if rec.user_id in user_has_pending:
if rec.user_id not in earliest_submission or earliest_submission[rec.user_id].recorded_utc > rec.recorded_utc:
if rec.user_id not in earliest_submission or earliest_submission[rec.user_id].recorded_datetimez > rec.recorded_datetimez:
earliest_submission[rec.user_id] = rec
badness = 0