aboutsummaryrefslogtreecommitdiff
path: root/admin
diff options
context:
space:
mode:
Diffstat (limited to 'admin')
-rw-r--r--admin/index.js7
-rw-r--r--admin/public/index.html7
-rw-r--r--admin/public/prediction.html28
-rw-r--r--admin/public/prediction.js11
4 files changed, 51 insertions, 2 deletions
diff --git a/admin/index.js b/admin/index.js
index 46b4f16..7479a3e 100644
--- a/admin/index.js
+++ b/admin/index.js
@@ -74,4 +74,11 @@ app.get("/api/participation", checkAdmin, async (req, res) => {
res.json(participation);
});
+app.get("/api/prediction", checkAdmin, async (req, res) => {
+ const prediction = await db.query(
+ "SELECT u.name uname, u.middlename umid, u.surname usur, t.name tname, t.middlename tmid, t.surname tsur FROM users u INNER JOIN teacher_prediction p ON u.id = p.user_id INNER JOIN users t ON t.id = p.teacher_id",
+ );
+ res.json(prediction);
+});
+
module.exports = app;
diff --git a/admin/public/index.html b/admin/public/index.html
index 83d3a00..f2506f2 100644
--- a/admin/public/index.html
+++ b/admin/public/index.html
@@ -24,8 +24,11 @@
<ul class="pure-menu-list">
<li class="pure-menu-item"><a href="ranking.html" class="pure-menu-link">Ranking</a></li>
<li class="pure-menu-item"><a href="questions.html" class="pure-menu-link">Fragen</a></li>
-<!-- <li class="pure-menu-item"><a href="votes.html" class="pure-menu-link">Votes</a></li>-->
-<!-- <li class="pure-menu-item"><a href="participation.html" class="pure-menu-link">Teilnahme</a></li>-->
+ <li class="pure-menu-item">
+ <a href="prediction.html" class="pure-menu-link">Wo sieht mich mein Lehrer in 10 Jahren</a>
+ </li>
+ <!-- <li class="pure-menu-item"><a href="votes.html" class="pure-menu-link">Votes</a></li>-->
+ <!-- <li class="pure-menu-item"><a href="participation.html" class="pure-menu-link">Teilnahme</a></li>-->
</ul>
</div>
</div>
diff --git a/admin/public/prediction.html b/admin/public/prediction.html
new file mode 100644
index 0000000..99e35e3
--- /dev/null
+++ b/admin/public/prediction.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <link
+ rel="stylesheet"
+ href="https://unpkg.com/purecss@2.0.3/build/pure-min.css"
+ integrity="sha384-cg6SkqEOCV1NbJoCu11+bm0NvBRc8IYLRGXkmNrqUBfTjmMYwNKPWBTIKyw9mHNJ"
+ crossorigin="anonymous"
+ />
+ <link rel="stylesheet" href="style.css" type="text/css" media="all" />
+
+ <title>Fragen</title>
+ </head>
+ <body>
+ <div class="pure-menu pure-menu-horizontal">
+ <a href="/" class="pure-menu-item pure-menu-link">Home</a>
+ <a href="/auth/api/logout" class="pure-menu-item pure-menu-link">Logout</a>
+ </div>
+ <div class="card">
+ <h2>Wo sieht mich mein Lehrer in 10 Jahren?</h2>
+ <ul id="list"></ul>
+ </div>
+
+ <script src="prediction.js"></script>
+ </body>
+</html>
diff --git a/admin/public/prediction.js b/admin/public/prediction.js
new file mode 100644
index 0000000..66afb06
--- /dev/null
+++ b/admin/public/prediction.js
@@ -0,0 +1,11 @@
+const list = document.getElementById("list");
+
+fetch("api/prediction")
+ .then((r) => r.json())
+ .then((r) => {
+ r.forEach((d) => {
+ const elem = document.createElement("li");
+ elem.innerText = `${d.uname} ${d.umid || ""} ${d.usur}: ${d.tname} ${d.tmid || ""} ${d.tsur}`;
+ list.appendChild(elem);
+ });
+ });