Devlog: Admin Approved Time Override## SummaryAdded approved_seconds to Ship model, allowing admins to approve a different duration than what was devlogged lets the ysws stay in a budget by removing charm_notches for time that won’t contribute to budget. This enables scenarios where a user logs 4h but admin only approves 2h for credit/charm calculations.## Changes### Database- Added approved_seconds integer column to ships table (defaults to devlogged_seconds if not explicitly set)### Models- Ship: New approved_seconds attribute with default, set_approved_seconds callback (copies from devlogged_seconds on create), and recalculate_charm_notches! method for manual sync- Project: ship_and_award_credits! now uses approved_seconds for credit/notch calculation; removed ship_total_notches validation- ShipRequest: approve! accepts and passes approved_seconds; reject! now destroys associated charm notches- User: reconcile_charm_notches! uses approved_seconds instead of devlogged_seconds for carryover calculations### Controllers- Admin ProjectsController: Pass approved_seconds param through approve/ship/force_ship actions- Admin ShipRequestsController: Pass approved_seconds param through approve action### Views- Ship request approval form: Added “Approved Time” field (number input, max = devlogged_seconds)- Ship cards: Display “Approved Hours” alongside devlogged hours### Tests- Comprehensive coverage for: - approved_seconds determining notch awards - Devlogged seconds copied to approved seconds when not set - Explicit approved_seconds overriding devlogged_seconds - Carryover hours across multiple ships - Multiplier application on approved_seconds - recalculate_charm_notches! syncing, removing excess, preserving admin_granted - reject! destroying charm notches (owner and recipient) - Controller test: approve respects approved_seconds for notch calculation## Backward CompatibilityThe set_approved_seconds callback defaults to devlogged_seconds when not explicitly set, so existing ships and flows without the new param continue working unchanged.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.