Skip to content

Filter updates#43

Merged
kernelcoffee merged 2 commits into
masterfrom
dev/giveaway_filters
Jul 18, 2026
Merged

Filter updates#43
kernelcoffee merged 2 commits into
masterfrom
dev/giveaway_filters

Conversation

@kernelcoffee

Copy link
Copy Markdown
Owner

Update filters on giveaway page

  • Add filters on win rates
  • Add filter on time left
  • Make filter persistent
  • Add win rate on giveaway card

…tate

Backend:
- New entries column on giveaways (+ migration); the scraper always
  parsed the entry count but the sync dropped it. Stored on create and
  refreshed on every scan update
- GiveawayResponse exposes entries and a computed win_chance percent
  (copies/entries*100, capped at 100; 100 when no entries yet)
- /giveaways/active and /giveaways/wishlist accept min_chance
  (0.01-100%) and ending_within (minutes), filtered in SQL alongside
  the existing min_score

Frontend:
- Giveaways page: stepped sliders on the Active and Wishlist tabs -
  Min Chance (Any, then 0.01%..100%) and Ending In (5min..24h, last
  notch Any); win-chance badge on cards with entry-count tooltip
- Filters (tab, score, safety, chance, time) now persist across visits
  via a localStorage-backed zustand store; search stays session-only
- The entries count never parsed: the links row on SteamGifts is
  <div class="giveaway__links">, not a span, so every giveaway stored
  0 entries - which made the win-chance filter pass everything and hid
  the chance badge. Also handle thousands separators ("1,234 entries"
  parsed as 234 with the old regex) and the singular "1 entry"
- Adaptive win_chance precision: two decimals for ordinary odds, four
  for long shots, so 1 copy / 25,000 entries reads 0.004% instead of
  collapsing to 0% (which read as 'no filter' in the UI)
- Cards always show the win chance for active giveaways, plus a
  dedicated entries line above the reviews (locale-formatted count,
  copies when >1, 'No entries recorded yet' before the first scan)

Verified live: after a scan, a 1,619-entry giveaway reports 0.0618%.
@kernelcoffee
kernelcoffee merged commit bf04074 into master Jul 18, 2026
6 checks passed
@kernelcoffee
kernelcoffee deleted the dev/giveaway_filters branch July 18, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant