13 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
Mike Dalessio 9c76002bc1 Completing a step removes stalled status from UI
Add `updatedAt` to stalled bubble options so JS can check if the card
was recently updated, matching the `Card::Stallable#stalled?`
logic. Refresh the bubble via Turbo Stream when a step is updated.

This should have been part of #1625

Fixes https://app.fizzy.do/5986089/cards/3668
2026-01-16 09:58:21 -05:00
Jason Zimdars 040c8a92c2 "Postpones" -> "Closes in" 2025-10-14 12:05:21 -05:00
Jorge Manrubia 2f6a639682 Prepare entropy code for the new auto postpone approach 2025-09-24 16:22:42 +02:00
Jorge Manrubia 6fe28c53e7 Extract common method 2025-09-16 13:06:01 +02:00
Jason Zimdars c56eb9ecd1 Cards in On Deck adopt some entropy behavior as ones in Doing 2025-09-16 13:06:01 +02:00
Jason Zimdars 9d706902e8 Style stalled bubble 2025-06-05 16:25:21 -05:00
Jason Zimdars 66da9e51e1 Merge branch 'main' into stalled-cards
* main:
  The joke is better if 11 is last 🤘🏻
  Filter here, too
  Keep up with filtering controller changes
  dep: update rack to 3.1.16
  Try minus
  Adjust icon and card header for events
  Fix that flash notices invisibly overlapped navbar
  Use card header in events
  Cap height and scroll list
  Fix that flash notices invisibly overlapped navbar
  Use card header in events
  Fix: update option when changing index
  Cap height and scroll list
2025-06-05 14:41:07 -05:00
Jason Zimdars 01352d0785 The joke is better if 11 is last 🤘🏻 2025-06-05 14:00:35 -05:00
Jorge Manrubia 2e60fcdf98 Dynamic bubble timers 2025-06-05 16:11:48 +02:00
Jorge Manrubia 6e8087ee2e Toggle entropy/stalled container in the bubbles controller 2025-06-05 11:08:20 +02:00
Jorge Manrubia 2cbd451944 Group entropy options in an object value
We'll add stalling considerations next, this helps keeping things organized.
2025-06-05 10:28:33 +02:00
Jorge Manrubia a5f7f34750 Rename helpers since they are not related to collections only anymore 2025-06-05 09:19:08 +02:00