Simplify min-day amount expression, remove extra variable
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
68075059d0
commit
95e7433941
@@ -79,11 +79,8 @@ export function computeDailyTarget(
|
||||
// Floor: must make at least minDayPnL today (or whatever is left if less)
|
||||
const floor = Math.min(effectiveMinDay, remaining);
|
||||
|
||||
// When consistency = 0% (baseAmount = 0), there's no consistency-based upper bound —
|
||||
// target cappedByFuture directly (make as much as possible today, reserve future days).
|
||||
// When consistency > 0%, treat baseAmount as the consistency cap.
|
||||
const consistencyCapped = baseAmount > 0 ? Math.min(baseAmount, cappedByFuture) : cappedByFuture;
|
||||
const amount = Math.max(floor, consistencyCapped);
|
||||
// 0% consistency → no upper bound, take cappedByFuture; otherwise cap at baseAmount
|
||||
const amount = Math.max(floor, baseAmount > 0 ? Math.min(baseAmount, cappedByFuture) : cappedByFuture);
|
||||
return { amount: Math.round(amount * 100) / 100, path };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user