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