aboutsummaryrefslogtreecommitdiff
path: root/bot
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-03-01 00:59:43 -0800
committerclarkzjw <[email protected]>2023-03-01 00:59:43 -0800
commit898701a2e3be108de7e50af90355076960e595f5 (patch)
treec8d9e61b4dbbedc8cb66d65ff6ef1b6da31ac9fa /bot
parentb02fb79f03aec9a5b7be34b15f320eca4e5e5c66 (diff)
downloadphoto-898701a2e3be108de7e50af90355076960e595f5.tar.gz
sort photos by uploadedAt
Diffstat (limited to 'bot')
-rw-r--r--bot/bot.py1
1 files changed, 1 insertions, 0 deletions
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:
73 "createdAt": photo.createdAt.strftime("%Y-%m-%dT%H:%M:%S.000Z"), 73 "createdAt": photo.createdAt.strftime("%Y-%m-%dT%H:%M:%S.000Z"),
74 "uploadedAt": photo.uploadedAt.strftime("%Y-%m-%dT%H:%M:%S.000Z") 74 "uploadedAt": photo.uploadedAt.strftime("%Y-%m-%dT%H:%M:%S.000Z")
75 }) 75 })
76 results.sort(key=lambda x: x["uploadedAt"], reverse=True)
76 with open("database/photos.json", "w") as f: 77 with open("database/photos.json", "w") as f:
77 f.write(json.dumps(results)) 78 f.write(json.dumps(results))
78 return True 79 return True
Powered by cgit v1.2.3 (git 2.41.0)