mirror of
https://github.com/skoelle/icloud-contacts-sync.git
synced 2026-09-17 15:30:24 +00:00
last sync with changes on dashboard
This commit is contained in:
@@ -195,10 +195,25 @@ def web_dashboard(
|
|||||||
)
|
)
|
||||||
last_sync = cur.fetchone()
|
last_sync = cur.fetchone()
|
||||||
|
|
||||||
|
change_filter = "AND account = %s" if account_name else ""
|
||||||
|
change_params = [account_name] if account_name else []
|
||||||
|
cur.execute(
|
||||||
|
f"""SELECT started_at, contacts_upserted
|
||||||
|
FROM sync_runs
|
||||||
|
WHERE contacts_upserted > 0 {change_filter}
|
||||||
|
ORDER BY started_at DESC
|
||||||
|
LIMIT 1""",
|
||||||
|
change_params,
|
||||||
|
)
|
||||||
|
last_sync_with_changes = cur.fetchone()
|
||||||
|
|
||||||
if last_sync:
|
if last_sync:
|
||||||
last_sync["started_at"] = str(last_sync["started_at"])
|
last_sync["started_at"] = str(last_sync["started_at"])
|
||||||
last_sync["finished_at"] = str(last_sync["finished_at"]) if last_sync["finished_at"] else None
|
last_sync["finished_at"] = str(last_sync["finished_at"]) if last_sync["finished_at"] else None
|
||||||
|
|
||||||
|
if last_sync_with_changes:
|
||||||
|
last_sync_with_changes["started_at"] = str(last_sync_with_changes["started_at"])
|
||||||
|
|
||||||
return templates.TemplateResponse(
|
return templates.TemplateResponse(
|
||||||
"dashboard.html",
|
"dashboard.html",
|
||||||
{
|
{
|
||||||
@@ -209,6 +224,7 @@ def web_dashboard(
|
|||||||
"contact_count": contact_count,
|
"contact_count": contact_count,
|
||||||
"upcoming_birthdays": upcoming_birthdays,
|
"upcoming_birthdays": upcoming_birthdays,
|
||||||
"last_sync": last_sync,
|
"last_sync": last_sync,
|
||||||
|
"last_sync_with_changes": last_sync_with_changes,
|
||||||
"current_year": date.today().year,
|
"current_year": date.today().year,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -252,6 +252,11 @@
|
|||||||
· {{ last_sync.contacts_deleted }} gelöscht
|
· {{ last_sync.contacts_deleted }} gelöscht
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
{% if last_sync_with_changes %}
|
||||||
|
<div class="sync-detail">
|
||||||
|
{{ last_sync_with_changes.started_at }} · {{ last_sync_with_changes.contacts_upserted }} aktualisiert
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% if last_sync.error_message %}
|
{% if last_sync.error_message %}
|
||||||
<div class="sync-detail" style="color: #dc3545; margin-top: 0.5rem;">
|
<div class="sync-detail" style="color: #dc3545; margin-top: 0.5rem;">
|
||||||
{{ last_sync.error_message }}
|
{{ last_sync.error_message }}
|
||||||
|
|||||||
Reference in New Issue
Block a user