diff options
author | clarkzjw <[email protected]> | 2023-03-01 00:59:43 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2023-03-01 00:59:43 -0800 |
commit | 898701a2e3be108de7e50af90355076960e595f5 (patch) | |
tree | c8d9e61b4dbbedc8cb66d65ff6ef1b6da31ac9fa /bot | |
parent | b02fb79f03aec9a5b7be34b15f320eca4e5e5c66 (diff) | |
download | photo-898701a2e3be108de7e50af90355076960e595f5.tar.gz |
sort photos by uploadedAt
Diffstat (limited to 'bot')
-rw-r--r-- | bot/bot.py | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -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 |