fix(ui): explain a 0 Buzz threshold in the price alerts panel

The default threshold is 0 ("only tell me when a version becomes free") and the
settings copy says so, but the panel did not: a real instance with 52 priced paid
versions and an untouched threshold showed "Nothing is under your price threshold
right now" with only a small "Alert threshold: 0 Buzz" in the corner, which reads
as a broken feature.

- the payload now carries pricedCount, so the empty state can say how many paid
  versions already have a known price
- when the threshold is 0 and prices are known, the empty state says so and
  points at Settings - Library instead of implying there is nothing to show
- the read-time threshold comparison means setting one takes effect immediately;
  measured on a copy of that instance: 0 Buzz -> 0 alerts, 100 -> 44,
  500 -> 48, 5000 -> 51
This commit is contained in:
Will Miao
2026-10-04 20:28:57 +08:00
parent 425d90a912
commit 156d2e5eb9
17 changed files with 148 additions and 23 deletions
+4
View File
@@ -4385,6 +4385,7 @@ class PriceAlertsHandler:
)
newest_checked_at = update_service.newest_price_checked_at()
unavailable_count = update_service.count_unavailable_prices()
priced_count = update_service.count_priced_versions()
except Exception as exc:
logger.error("Failed to load price alerts: %s", exc, exc_info=True)
return web.json_response(
@@ -4410,6 +4411,9 @@ class PriceAlertsHandler:
# Gated versions whose price could not be read (mature models
# are served only by the challenged civitai.red host).
"unavailableCount": unavailable_count,
# Lets the empty state explain a 0 Buzz threshold instead of
# claiming there is simply nothing to show.
"pricedCount": priced_count,
"alerts": alerts,
}
)