Repository navigation
fix(plans): prefill non-preset weekly and monthly ramps as custom in Edit - #1183
Conversation
…Edit Edit mapped a stored ramp to a preset radio by type and percent only, and sent every other weekly or monthly ramp (e.g. weekly 20%, monthly 5%) to "immediate", so the form and preview showed one step and Save would have rewritten the schedule. A ramp now matches a preset only when type, percent and interval all match; every other non-immediate ramp is prefilled as custom with its stored percent and interval. Closes #1156 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 3 billable files and costs up to $0.75.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 1 second for your next included review. View limit details
Comment |
Merge gate at
|
Summary
Closes #1156
Opening Edit on a plan whose stored ramp is weekly at a percent other than 25 (or monthly other than 10) pre-selected Immediate. The inline preview then showed one step, and Save would have rewritten the plan's ramp to immediate.
21da8497replaces the inline if-chain ineditPlanwith a small pure helper,rampRadioValue, and aPRESET_RAMPStable:immediateramp maps to Immediate;internal/config/types.go:272-283);Round-trip check against the backend
buildRampSchedule/buildCustomRampSchedule(internal/api/types.go:~850-891) compute custom steps asint(100/pct). Next-execution and step dates depend only on percent and interval, the same as for the presets. A weekly 20%/7d plan saved as custom keeps 5 steps on the same dates, and monthly 5%/30d keeps 20.The inline preview (
plan-schedule-intent.ts:30,Math.floor) already counts steps the same way as the backend (internal/api/types.go:882). The onlyMath.ceilis ingeneratePlanName(plans.ts:1882), which affects only the auto-generated name of a new plan whose percent does not divide 100.Tests
test.eachover 7 stored ramps (radio, custom fields, preview steps):Verification evidence is posted as PR comments.
🤖 Generated with Claude Code