feat(report-card): decorative waves + exclude current entry from student works

This commit is contained in:
dev
2026-10-20 15:36:14 +03:00
parent ea8722b544
commit 451ca278cc
4 changed files with 32 additions and 5 deletions
+4 -3
View File
@@ -293,15 +293,16 @@ async function hydrateReportCardStudentWorks(e) {
if (!box) return;
const name = String(e.student_name || '').trim();
if (!name) { box.remove(); return; }
const cached = studentWorksCache.get(name);
const key = `${name}#${e.id}`;
const cached = studentWorksCache.get(key);
if (cached) { paintReportCardStudentWorks(box, cached, e.id); return; }
box.classList.add('is-loading');
box.innerHTML = '<span class="sc-w__spin" aria-hidden="true"></span>';
try {
const res = await fetch(`${API}/api/students/works-by-name?name=${encodeURIComponent(name)}&limit=3`, { headers: hdr() });
const res = await fetch(`${API}/api/students/works-by-name?name=${encodeURIComponent(name)}&limit=3&exclude_entry=${encodeURIComponent(e.id)}`, { headers: hdr() });
const data = await res.json();
const photos = (data.photos || []).filter(Boolean);
studentWorksCache.set(name, photos);
studentWorksCache.set(key, photos);
if (reportCardEntryId !== e.id) return;
paintReportCardStudentWorks(document.getElementById('reportCardStudentWorks'), photos, e.id);
} catch (err) {