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>
// ── Rating stars ─────────────────────────────────────────────────────────────
function setRating(btn) {
const group = btn.closest('.rating-stars');
const val = parseInt(btn.dataset.val);
const input = document.getElementById(btn.dataset.target);
group.dataset.rating = val;
if (input) input.value = val;
const group = btn.closest('.rating-stars');
const clicked = parseInt(btn.dataset.val);
const current = parseInt(group.dataset.rating || 0);
const input = document.getElementById(btn.dataset.target);
// 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 => {
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
email-validator
gunicorn
pytz