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
All checks were successful
Deploy yourpart (blue-green) / deploy (push) Successful in 2m58s
This commit is contained in:
@@ -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
|
||||
})));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user