From 9e69d376c61b89713cf5aeae211b9565b09be036 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Sat, 10 May 2025 22:31:41 +0200 Subject: [PATCH] formatted stylesheet --- public/css/style.css | 8 ++++---- src/routes/answers.js | 19 ++++--------------- src/utils/process_data.js | 4 ++-- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index 18c0ed3..9f73555 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -81,10 +81,10 @@ table tbody tr:hover { /* style id column values */ table tbody td:nth-child(1) { - font-family: monospace; - width: 8ch; - white-space: normal; - word-break: break-all; + font-family: monospace; + width: 8ch; + white-space: normal; + word-break: break-all; } /* style score header */ diff --git a/src/routes/answers.js b/src/routes/answers.js index 25a1d6d..de079b2 100644 --- a/src/routes/answers.js +++ b/src/routes/answers.js @@ -80,23 +80,12 @@ router.post("/submit/comments", upload.single("file"), async (req, res) => { io.to(socketId).emit("started-processing"); } - evaluate_comments( - validatedData, - (percent) => { - if (!(socketId && io.sockets.sockets.has(socketId))) return; + const results = evaluate_comments(validatedData, (percent) => { + if (!(socketId && io.sockets.sockets.has(socketId))) return; - io.to(socketId).emit("progress", { percent }); - }, - (results) => { - if (!(socketId && io.sockets.sockets.has(socketId))) return; - io.to(socketId).emit("ended-processing", results); - }, - ); - - res.status(200).json({ - message: "Answer submitted successfully", - data: validatedData, + io.to(socketId).emit("progress", { percent }); }); + res.status(200).json(results); } catch (error) { console.error("Error processing submission:", error); res.status(500).json({ error: "Error processing submission" }); diff --git a/src/utils/process_data.js b/src/utils/process_data.js index 72ccdaa..2af9fb3 100644 --- a/src/utils/process_data.js +++ b/src/utils/process_data.js @@ -15,7 +15,7 @@ function buildReferenceMap(dataset_path) { const REFERENCE_MAP = buildReferenceMap(getProjectPath("data/dataset.json")); -export const evaluate_comments = async (answers, percent_cb, finished_cb) => { +export const evaluate_comments = (answers, percent_cb) => { const total = Object.keys(answers).length; let i = 0; const results = {}; @@ -42,7 +42,7 @@ export const evaluate_comments = async (answers, percent_cb, finished_cb) => { }; percent_cb(Math.floor((++i / total) * 100)); } - finished_cb(results); + return results; }; export const evaluate_refinement = async (answers, percent_cb, finished_cb) => {