diff --git a/index.php b/index.php index 39ce739..22e469f 100644 --- a/index.php +++ b/index.php @@ -13,7 +13,8 @@ include $_SERVER["DOCUMENT_ROOT"] . "/php/pages.php"; -

Witaj na quiz.czem.eu

+

Witaj na quiz.czem.eu

Wybierz typ quizu

@@ -38,7 +39,7 @@ include $_SERVER["DOCUMENT_ROOT"] . "/php/pages.php";

Inne

-
+

Twoje wyniki

diff --git a/score/index.php b/score/index.php new file mode 100644 index 0000000..71fee53 --- /dev/null +++ b/score/index.php @@ -0,0 +1,31 @@ + + + + + + + + quiz.czem.eu + + + + + +

Twoje wyniki na testy i pytania

+
+
+

Przejdź do zapisanych wyników

+
+

Zapisane Testy

+
+
+

Pojedyńcze pytania

+
+

Wróć do strony głównej

+
+
+ + + \ No newline at end of file diff --git a/score/score.css b/score/score.css new file mode 100644 index 0000000..e69de29 diff --git a/test/test.js b/test/test.js index a30305e..265b632 100644 --- a/test/test.js +++ b/test/test.js @@ -43,6 +43,7 @@ document.addEventListener("DOMContentLoaded", function () { if (logged && !own) contentHTML += ``; contentHTML += `

+

Wróc do strony głównej

`; mainContent.innerHTML = contentHTML; @@ -71,13 +72,14 @@ document.addEventListener("DOMContentLoaded", function () { if (result.status == "OK") { window.scrollTo({ top: 0, behavior: 'smooth' }); Object.entries(result.answers).forEach(function ([key, arr]) { - if (!arr.correct && arr.answeredChar != "-") { + let correctLetter = ["A", "B", "C", "D"].includes(arr.answeredChar); + if (!arr.correct && correctLetter) { document.getElementById(`q${key}`).innerHTML = `Nieprawidłowa odpowiedź, odpowiedziałeś ${arr.answeredChar}, prawidłowa odpowiedź to ${arr.correctChar}`; document.getElementById(`q${key}`).style.color = "red"; document.getElementById(`${arr.answeredChar}${key}`).style.color = "red"; document.getElementById(`${arr.correctChar}${key}`).style.color = "green"; } - else if (arr.answeredChar == "-") { + else if (!correctLetter) { document.getElementById(`q${key}`).innerHTML = `Nie odpowiedziałeś na pytanie, prawidłowa odpowiedź to ${arr.correctChar}`; document.getElementById(`q${key}`).style.color = "red"; document.getElementById(`${arr.correctChar}${key}`).style.color = "green"; @@ -88,6 +90,11 @@ document.addEventListener("DOMContentLoaded", function () { } }); + const output = document.getElementById("info"); + resultProcent = result.correctAnswers/result.testLength*100 + output.innerHTML = `Prawidłowe odpowiedzi: ${result.correctAnswers}/${result.testLength} - ${resultProcent}%`; + if (resultProcent >= 50) output.style.color = "green"; + output.style.display = "block"; document.getElementById("end").style.display = "none"; } else alert("Wystąpił błąd, spróbuj ponownie"); });