Feb 02 2026: fix star rating when inspection

This commit is contained in:
2026-02-28 12:53:55 -05:00
parent ab2d5546b4
commit 1ac3eac982
2 changed files with 12 additions and 6 deletions
+11 -6
View File
@@ -449,13 +449,18 @@
<script> <script>
// ── Rating stars ───────────────────────────────────────────────────────────── // ── Rating stars ─────────────────────────────────────────────────────────────
function setRating(btn) { function setRating(btn) {
const group = btn.closest('.rating-stars'); const group = btn.closest('.rating-stars');
const val = parseInt(btn.dataset.val); const clicked = parseInt(btn.dataset.val);
const input = document.getElementById(btn.dataset.target); const current = parseInt(group.dataset.rating || 0);
group.dataset.rating = val; const input = document.getElementById(btn.dataset.target);
if (input) input.value = val;
// Toggle off: clicking the currently active star clears the rating to 0.
const newVal = (clicked === current) ? 0 : clicked;
group.dataset.rating = newVal;
if (input) input.value = newVal;
group.querySelectorAll('button').forEach(b => { group.querySelectorAll('button').forEach(b => {
b.classList.toggle('on', parseInt(b.dataset.val) <= val); b.classList.toggle('on', parseInt(b.dataset.val) <= newVal);
}); });
} }
+1
View File
@@ -11,3 +11,4 @@ Pillow
WTForms WTForms
email-validator email-validator
gunicorn gunicorn
pytz