diff --git a/src/api/main.py b/src/api/main.py
index 9df2f6b..83bec91 100644
--- a/src/api/main.py
+++ b/src/api/main.py
@@ -536,6 +536,7 @@ def web_search_special(
"no_photo": db.search_contacts_without_photo,
"no_city": db.search_contacts_without_city,
"no_social": db.search_contacts_without_social,
+ "last_updated": db.search_contacts_last_updated,
}.get(type)
if not query_fn:
@@ -545,6 +546,7 @@ def web_search_special(
"no_photo": "Kontakte ohne Bild",
"no_city": "Kontakte ohne Stadt",
"no_social": "Kontakte ohne Social Profil",
+ "last_updated": "Zuletzt aktualisiert",
}
with db.get_connection() as conn:
diff --git a/src/api/templates/_sidebar.html b/src/api/templates/_sidebar.html
index cbc89a5..6ffc55d 100644
--- a/src/api/templates/_sidebar.html
+++ b/src/api/templates/_sidebar.html
@@ -92,5 +92,6 @@
ohne Bild
ohne City
ohne Social
+ last updated
diff --git a/src/db.py b/src/db.py
index 46d3a1c..7f9784b 100644
--- a/src/db.py
+++ b/src/db.py
@@ -232,6 +232,24 @@ def search_contacts_without_social(conn, account: str | None) -> list[dict]:
return cur.fetchall()
+def search_contacts_last_updated(conn, account: str | None) -> list[dict]:
+ where_clause, params = _account_filter_clause(account)
+ op = "AND" if where_clause else "WHERE"
+ with conn.cursor() as cur:
+ cur.execute(
+ f"""SELECT id, full_name, given_name, middle_name, family_name,
+ prefix, suffix, organization, birthday, account, photo_url
+ FROM contacts {where_clause}
+ {op} given_name IS NOT NULL AND given_name != ''
+ AND family_name IS NOT NULL AND family_name != ''
+ AND family_name != 'X'
+ ORDER BY updated_at DESC
+ LIMIT 200""",
+ params,
+ )
+ return cur.fetchall()
+
+
def get_most_common_birthday(conn) -> date | None:
with conn.cursor() as cur:
cur.execute(