Refactor transport planning in DirectorWorker: Updated variable naming for clarity by changing 'shipped' to '_shipped' to indicate unused variable. Removed unused get_branch_user_id function from TransportWorker to streamline code and improve maintainability.

This commit is contained in:
Torsten Schulz (local)
2025-12-05 14:20:56 +01:00
parent f481ef4b73
commit 8db82e0ced
2 changed files with 1 additions and 25 deletions

View File

@@ -930,7 +930,7 @@ impl DirectorWorker {
// - Inventar-Mengen reduziert (geschieht bereits in plan_transports_for_item)
// Die zurückgegebenen Mengen werden dann lokal verkauft.
for item in items.iter_mut() {
let shipped = self.plan_transports_for_item(
let _shipped = self.plan_transports_for_item(
&mut conn,
falukant_user_id,
item,

View File

@@ -492,30 +492,6 @@ impl TransportWorker {
Ok(())
}
fn get_branch_user_id(pool: &ConnectionPool, branch_id: i32) -> Result<i32, DbError> {
let mut conn = pool
.get()
.map_err(|e| DbError::new(format!("DB-Verbindung fehlgeschlagen: {e}")))?;
const QUERY_GET_BRANCH_USER: &str = r#"
SELECT falukant_user_id
FROM falukant_data.branch
WHERE id = $1
LIMIT 1;
"#;
conn.prepare("get_branch_user", QUERY_GET_BRANCH_USER)?;
let rows = conn.execute("get_branch_user", &[&branch_id])?;
let user_id = rows
.get(0)
.and_then(|r| r.get("falukant_user_id"))
.and_then(|v| v.parse::<i32>().ok())
.unwrap_or(-1);
Ok(user_id)
}
fn insert_transport_waiting_notification(
pool: &ConnectionPool,
user_id: i32,