Enhance logging and error handling in DirectorWorker: Added detailed logging for production, transport, and sales checks for directors. Included a warning message when no directors are found for actions, improving visibility into the task execution process.

This commit is contained in:
Torsten Schulz (local)
2025-12-01 10:09:19 +01:00
parent fbca231de5
commit d5017ef1e1

View File

@@ -291,6 +291,7 @@ impl DirectorWorker {
} }
fn perform_all_tasks(&mut self) -> Result<(), DbError> { fn perform_all_tasks(&mut self) -> Result<(), DbError> {
// Produktions-/Verkaufs-/Transportlogik für alle Direktoren
self.perform_task()?; self.perform_task()?;
self.pay_salary()?; self.pay_salary()?;
self.calculate_satisfaction()?; self.calculate_satisfaction()?;
@@ -315,14 +316,30 @@ impl DirectorWorker {
.filter_map(Self::map_row_to_director) .filter_map(Self::map_row_to_director)
.collect(); .collect();
if directors.is_empty() {
eprintln!("[DirectorWorker] Keine Direktoren für Aktionen gefunden (Zeitfenster oder DB-Daten).");
}
for director in directors { for director in directors {
if director.may_produce { if director.may_produce {
eprintln!(
"[DirectorWorker] Starte Produktionsprüfung für Director {}",
director.id
);
self.start_productions(&director)?; self.start_productions(&director)?;
} }
if director.may_start_transport { if director.may_start_transport {
eprintln!(
"[DirectorWorker] Starte Transportprüfung für Director {}",
director.id
);
self.start_transports_stub(&director); self.start_transports_stub(&director);
} }
if director.may_sell { if director.may_sell {
eprintln!(
"[DirectorWorker] Starte Verkaufsprüfung für Director {}",
director.id
);
self.start_sellings(&director)?; self.start_sellings(&director)?;
} }
} }