Add SQL query to count children by user: Introduced a new query to count distinct children associated with a user across all their characters. Updated UserCharacterWorker to utilize this new query, replacing the previous count query. This enhances user-specific data retrieval capabilities.

This commit is contained in:
Torsten Schulz (local)
2026-02-02 15:25:13 +01:00
parent 460310ae89
commit 658a9034ed
5 changed files with 35 additions and 264 deletions

View File

@@ -26,7 +26,7 @@ use crate::worker::sql::{
QUERY_GET_SETTLEMENT_VALUE,
QUERY_GET_INVENTORY_VALUE,
QUERY_GET_CREDIT_DEBT,
QUERY_COUNT_CHILDREN,
QUERY_COUNT_CHILDREN_BY_USER,
QUERY_GET_HEIR,
QUERY_RANDOM_HEIR,
QUERY_SET_CHARACTER_USER,
@@ -844,8 +844,8 @@ impl UserCharacterWorker {
.get()
.map_err(|e| DbError::new(format!("DB-Verbindung fehlgeschlagen: {e}")))?;
conn.prepare("count_children", QUERY_COUNT_CHILDREN)?;
let rows = conn.execute("count_children", &[&deceased_user_id])?;
conn.prepare("count_children_by_user", QUERY_COUNT_CHILDREN_BY_USER)?;
let rows = conn.execute("count_children_by_user", &[&deceased_user_id])?;
Ok(rows
.first()