mirror of
https://codeberg.org/diginaut/digimarks.git
synced 2026-02-04 10:20:26 +01:00
Keep in account that there might be no modifications yet
This commit is contained in:
@@ -275,12 +275,24 @@ async def bookmarks_changed_since(
|
||||
)
|
||||
latest_created_bookmark = result.first()
|
||||
|
||||
latest_modification = max(latest_modified_bookmark.modified_date, latest_created_bookmark.created_date)
|
||||
# There needs to be at least one bookmark of course
|
||||
if latest_created_bookmark:
|
||||
latest_created_datetime = latest_created_bookmark.created_date
|
||||
else:
|
||||
latest_created_datetime = datetime.min
|
||||
|
||||
# We only have a modified datetime when at least one has been edited
|
||||
if latest_modified_bookmark:
|
||||
latest_modified_datetime = latest_modified_bookmark.modified_date
|
||||
else:
|
||||
latest_modified_datetime = datetime.min
|
||||
|
||||
latest_modification = max(latest_modified_datetime, latest_created_datetime)
|
||||
|
||||
return {
|
||||
'current_time': datetime.now(UTC),
|
||||
'latest_change': latest_modified_bookmark.modified_date,
|
||||
'latest_created': latest_created_bookmark.created_date,
|
||||
'latest_change': latest_modified_datetime,
|
||||
'latest_created': latest_created_datetime,
|
||||
'latest_modification': latest_modification,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user