feat(report-card): decorative waves + exclude current entry from student works
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user