From 898701a2e3be108de7e50af90355076960e595f5 Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Wed, 1 Mar 2023 00:59:43 -0800 Subject: sort photos by uploadedAt --- bot/bot.py | 1 + 1 file changed, 1 insertion(+) (limited to 'bot') diff --git a/bot/bot.py b/bot/bot.py index 9d9b322..f379e95 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -73,6 +73,7 @@ def write_json() -> bool: "createdAt": photo.createdAt.strftime("%Y-%m-%dT%H:%M:%S.000Z"), "uploadedAt": photo.uploadedAt.strftime("%Y-%m-%dT%H:%M:%S.000Z") }) + results.sort(key=lambda x: x["uploadedAt"], reverse=True) with open("database/photos.json", "w") as f: f.write(json.dumps(results)) return True -- cgit v1.2.3