Commit Graph

17 Commits

Author SHA1 Message Date
Rob Zolkos 23ac76555b Validate and normalize auto-postpone period to days (#2672)
* Validate and normalize auto-postpone period to days

- Add Entropy::AUTO_POSTPONE_PERIODS and validate auto_postpone_period against the allowed set
- Introduce auto_postpone_period_in_days for forms and entropy update endpoints
- Fall back to index 0 in knob partial when current value isn't in options
- Remove entropy_auto_close_options helper in favor of model constant
- Update tests to use allowed period values

* Use auto_postpone_period_in_days for JSON entropy updates

The JSON API was accepting auto_postpone_period (seconds) which
bypassed the days normalization and validation. Switch to
auto_postpone_period_in_days consistently and add explicit
wrap_parameters so flat JSON params are wrapped correctly for
the virtual attribute.

* Default to account or 30-day fallback when knob value is invalid

* Address PR review feedback for entropy validation

- Fall back to first knob option (index 0) when persisted value isn't in
  the allowed set, preventing nil index errors for legacy values
- Use integer division (1.day.to_i) for consistent day calculations

* Default to account entropy period instead of first option for knob fallback

* Test that default auto-postpone period is in the allowed periods

* Return 422 instead of 500 for invalid entropy auto-postpone values

Rescue ActiveRecord::RecordInvalid in entropy controllers so invalid
auto_postpone_period_in_days values return 422 Unprocessable Entity
instead of raising a 500.

* Fix NoMethodError when board entropy falls back to account default

Use container.account.entropy.auto_postpone_period_in_days instead of
container.account.auto_postpone_period_in_days since Account doesn't
delegate that method.

* Test board entropy fallback to account default for invalid periods
2026-03-09 17:37:56 -04:00
Jason Zimdars 7ed4884986 Disable most account and board settings for non-admins 2025-11-07 16:01:50 -06:00
Jason Zimdars 7f4103682b Tighten up and remove unnecessary spacing and test sizing 2025-10-01 10:21:54 -05:00
Jorge Manrubia 2f6a639682 Prepare entropy code for the new auto postpone approach 2025-09-24 16:22:42 +02:00
Jason Zimdars 1bcaee6da2 No more falling back
Still needs implemented but we won't be autoreconsidering anymore. All
entropy will auto-close with reasion: Not now so it appears in the Not
Now column
2025-09-22 13:57:12 -05:00
Jason Zimdars c56eb9ecd1 Cards in On Deck adopt some entropy behavior as ones in Doing 2025-09-16 13:06:01 +02:00
Andy Smith ab0b3055c9 Cleanup 2025-09-10 13:18:59 -05:00
Jason Zimdars 65c61c4bab Rename engagement columns 2025-08-27 13:48:36 -05:00
Jason Zimdars ff48f8a301 Copy 2025-08-21 21:29:46 -05:00
Jason Zimdars 00c975fbe7 Tone-down add card button, copy edits 2025-08-20 17:24:59 -05:00
Jorge Manrubia a5f7f34750 Rename helpers since they are not related to collections only anymore 2025-06-05 09:19:08 +02:00
Jorge Manrubia a014af6ef0 Simplify 2025-06-05 09:16:38 +02:00
Jorge Manrubia cb1ee9eabd Format 2025-06-05 08:54:42 +02:00
Jorge Manrubia b9dd7fe808 Tidy up code 2025-06-05 08:54:31 +02:00
Jason Zimdars e42c6548b0 Wire up knob UI design 2025-06-04 20:28:20 -05:00
Jason Zimdars 10224c2698 Extract the header so we can explain in context 2025-06-04 15:30:19 -05:00
Jorge Manrubia 3c61fc3cdf Add screen to edit account settings to tweak default entropy configuration 2025-06-04 11:25:10 +02:00