Enhance money change event handling: Added a new loss field to the JSON response in the EventsWorker to display the loss amount as a positive value, improving clarity for UI text. Updated the calculation logic to ensure accurate representation of financial changes.
All checks were successful
Deploy yourpart (blue-green) / deploy (push) Successful in 2m58s

This commit is contained in:
Torsten Schulz (local)
2026-04-10 08:39:45 +02:00
parent ebf20c4424
commit 1111377913

View File

@@ -1319,10 +1319,15 @@ impl EventsWorker {
)
.unwrap_or(absolute_change);
// `absolute` ist negativ (Abgang). `loss` positiv — für UI-Texte wie „Verlust: {loss}“
// (ohne `Math.abs` auf `absolute`).
let loss_display = (-applied_change).max(0.0);
return Ok(Some(json!({
"type": "money_change",
"percent": percent_change,
"absolute": applied_change
"absolute": applied_change,
"loss": loss_display
})));
}