Spaces:
Running
Running
Download components/feedback-data.js from jusdy/pa-performance-wizard: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/spaces/jusdy/pa-performance-wizard/resolve/main/components/feedback-data.js
- Command line
-
hf download hf://spaces/jusdy/pa-performance-wizard/components/feedback-data.js
-
curl -L -o feedback-data.js https://huggingface.co/spaces/jusdy/pa-performance-wizard/resolve/main/components/feedback-data.js
1.08 kB
| class FeedbackData extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| } | |
| </style> | |
| `; | |
| this.data = [ | |
| // All the feedback data entries would go here | |
| // Example format: | |
| { | |
| timestamp: "11/5/2025 10:53:16", | |
| ratings: [5,5,5,5,5,5,5,5,5], | |
| class: "SKE 1A", | |
| session: "SESI 1 2025/2026", | |
| comment: "tiada" | |
| }, | |
| // ... (all other entries in same format) | |
| ]; | |
| } | |
| getFeedbackByClass(className) { | |
| return this.data.filter(item => item.class === className); | |
| } | |
| getFeedbackBySession(session) { | |
| return this.data.filter(item => item.session === session); | |
| } | |
| getAverageRatings() { | |
| const averages = Array(9).fill(0); | |
| this.data.forEach(item => { | |
| item.ratings.forEach((rating, index) => { | |
| averages[index] += rating; | |
| }); | |
| }); | |
| return averages.map(avg => avg / this.data.length); | |
| } | |
| } | |
| customElements.define('feedback-data', FeedbackData); |