This commit is contained in:
Turtle committed 2025-12-31 12:46:26 +01:00
1 parent e7ac75fd76
commit 76258c2291
1 file changed
+49 -12
+49 -12
View File
@@ -8,6 +8,7 @@
<script src="../lib/basic.js"></script> <script src="../lib/basic.js"></script>
<script src="../other/skills.js"></script> <script src="../other/skills.js"></script>
<script src="../other/skilltree.js"></script> <script src="../other/skilltree.js"></script>
<title>Auswertung</title>
</head> </head>
<body> <body>
<style> <style>
@@ -77,6 +78,14 @@ button.navigation:hover {
overflow-y: scroll; overflow-y: scroll;
overflow-x: hidden; overflow-x: hidden;
} }
.content-table > tbody > tr:first-child > td:last-child > div button {
padding: 5px;
font-size: 16px;
font-weight: normal;
margin-top: 5px;
background-color: var(--accent_color_bg_o);
border-radius: var(--border-radius);
}
#umfrage_list > div { #umfrage_list > div {
padding: 10px; padding: 10px;
border: 2px solid var(--accent_color_bg); border: 2px solid var(--accent_color_bg);
@@ -126,14 +135,16 @@ async function loadStats() {
const course = await couchDB.get("course:" + i); const course = await couchDB.get("course:" + i);
if (course == null) continue; if (course == null) continue;
for (var i2 of (course["result_history"] ?? [])) { const list = course["result_history"] ?? [];
udiv.innerHTML += _createElement1(course, i2); for (var pos in list) {
const i2 = list[pos];
udiv.innerHTML += _createElement1(course, i2, i, pos);
} }
udiv.innerHTML += _createElement1(course, { udiv.innerHTML += _createElement1(course, {
"date": course.expire_date, "date": course.expire_date,
"questions": course.questions ?? [], "questions": course.questions ?? [],
"result": course.result ?? [] "result": course.result ?? []
}); }, i);
} }
let studenten = gesamtAuswertung[3].reduce((acc, val) => acc + val, 0) / gesamtAuswertung[3].length; let studenten = gesamtAuswertung[3].reduce((acc, val) => acc + val, 0) / gesamtAuswertung[3].length;
@@ -141,14 +152,14 @@ async function loadStats() {
gdiv.innerHTML = ` gdiv.innerHTML = `
<b>Gesamtbewertung:</b><br><br> <b>Gesamtbewertung:</b><br><br>
Positiv bewertet: ${gesamtAuswertung[0]}<br> Positiv bewertet: ${round(gesamtAuswertung[0])}<br>
Neutral bewertet: ${gesamtAuswertung[1]}<br> Neutral bewertet: ${round(gesamtAuswertung[1])}<br>
Negativ bewertet: ${gesamtAuswertung[2]}<br><br> Negativ bewertet: ${round(gesamtAuswertung[2])}<br><br>
<i>Studenten im Durchschnitt:</i> ${studenten} <i>Studenten im Durchschnitt:</i> ${round(studenten)}
`; `;
} }
function _createElement1(course, data) { function _createElement1(course, data, name, pos = -1) {
const startDate = data.date; const startDate = data.date;
const title = course.title; const title = course.title;
@@ -197,17 +208,25 @@ function _createElement1(course, data) {
} }
var endNote; var endNote;
var bttn;
if (percentages[0] > percentages[1] && percentages[0] > percentages[2]) { if (percentages[0] > percentages[1] && percentages[0] > percentages[2]) {
endNote = "Überwiegend positiv"; endNote = "Überwiegend positiv";
gesamtAuswertung[0] ++; gesamtAuswertung[0] ++;
bttn = `<button onclick='getXpPoints(this, 2, "${name}", ${pos})'>2 XP abholen</button>`;
} else if (percentages[2] > percentages[0] && percentages[2] > percentages[1]) { } else if (percentages[2] > percentages[0] && percentages[2] > percentages[1]) {
endNote = "Überwiegend negativ"; endNote = "Überwiegend negativ";
gesamtAuswertung[2] ++; gesamtAuswertung[2] ++;
bttn = '';
} else { } else {
endNote = "Gemischt"; endNote = "Gemischt";
gesamtAuswertung[1] ++; gesamtAuswertung[1] ++;
bttn = `<button onclick='getXpPoints(this, 1, "${name}", ${pos})'>1 XP abholen</button>`;
} }
const expire_date = new Date(data.date);
if ((data["got_xp"] ??= false) || expire_date > new Date()) {
bttn = '';
}
return `<div> return `<div>
<table style="width: 100%; border-collapse:collapse; " class="selectable"> <table style="width: 100%; border-collapse:collapse; " class="selectable">
@@ -221,22 +240,40 @@ function _createElement1(course, data) {
</tr> </tr>
<tr> <tr>
<td style="padding-left: 15px; display: inline-block; padding-top: 10px; vertical-align: top;"> <td style="padding-left: 15px; display: inline-block; padding-top: 10px; vertical-align: top;">
Positive: ${percentages[0]}%<br> Positive: ${round(percentages[0])}%<br>
Negative: ${percentages[2]}%<br> Negative: ${round(percentages[2])}%<br>
Neutral: ${percentages[1]}%<br> Neutral: ${round(percentages[1])}%<br>
</td> </td>
<td style="padding-top: 10px; vertical-align: top;"> <td style="padding-top: 10px; vertical-align: top;">
<u>Endnote</u>: ${endNote} <u>Endnote</u>: ${endNote}<br>
${bttn}
</td> </td>
</tr> </tr>
</table> </table>
</div>`; </div>`;
} }
function round(n) {
return Number(n.toFixed(2)).toString();
}
async function init() { async function init() {
await loadStats(); await loadStats();
} }
async function getXpPoints(elm, xp, name, pos) {
elm.remove();
playLevelSound();
const course = await couchDB.get("course:" + name);
const data = course.result_history[pos];
data["got_xp"] = true;
await levelUpXP(couchDB, userData, xp);
await couchDB.set("course:" + name, course);
}
</script> </script>
</body> </body>
</html> </html>