special search last updated

This commit is contained in:
2026-08-11 20:32:32 +02:00
parent 619ea84c5f
commit 4c743036d5
3 changed files with 21 additions and 0 deletions
+2
View File
@@ -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:
+1
View File
@@ -92,5 +92,6 @@
<a href="/search/special?type=no_photo" class="special-search-link">ohne Bild</a>
<a href="/search/special?type=no_city" class="special-search-link">ohne City</a>
<a href="/search/special?type=no_social" class="special-search-link">ohne Social</a>
<a href="/search/special?type=last_updated" class="special-search-link">last updated</a>
</div>
</div>
+18
View File
@@ -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(