diff --git a/frontend/index.html b/frontend/index.html index 115edc7..6685ad5 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -413,6 +413,57 @@ } } + function renderItemRatingStats(comments) { + if (!comments || comments.length === 0) return ''; + + const stats = { quality: [], efficiency: [], creativity: [], learning: [] }; + comments.forEach(c => { + if (c.quality) stats.quality.push(c.quality); + if (c.efficiency) stats.efficiency.push(c.efficiency); + if (c.creativity) stats.creativity.push(c.creativity); + if (c.learning) stats.learning.push(c.learning); + }); + + const hasAnyScore = stats.quality.length > 0 || stats.efficiency.length > 0 || + stats.creativity.length > 0 || stats.learning.length > 0; + + if (!hasAnyScore) return ''; + + const avg = (arr) => arr.length > 0 ? (arr.reduce((a,b) => a+b, 0) / arr.length).toFixed(1) : '-'; + + return ` +
+ `; + } + function renderEmbeddedComments(contentType, objectId, comments) { if (!comments || comments.length === 0) return ''; @@ -438,6 +489,7 @@ `; }).join('')} + ${renderItemRatingStats(comments)} `; } @@ -612,7 +664,6 @@ๅฎๆ็
็ป้ช