aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcli.js19
-rw-r--r--zeitung/parts/rankingtemplate.tex10
2 files changed, 17 insertions, 12 deletions
diff --git a/cli.js b/cli.js
index 942714d..378fea8 100755
--- a/cli.js
+++ b/cli.js
@@ -170,17 +170,28 @@ if ((idx = params.indexOf("-r")) > -1) {
await fs.writeFile(__dirname + "/zeitung/parts/generated/stats/perc.tex", textex);
// Teacher ranking pranking banking yanking
- textex = "\\ranking\n";
+ const rankingStart = "\\begin{tabularx}{\\textwidth}{*{3}{>{\\RaggedRight\\arraybackslash}X}}\n";
+ const rankingEnd = "\\end{tabularx}\n";
+ textex = "\\ranking" + rankingStart;
const teacher_ranking = data.ranking.filter((e) => e.type === "teacher");
- teacher_ranking.forEach((e) => {
+ teacher_ranking.forEach((e, ind) => {
+ textex += "\\begin{itemize}\n";
textex += `\\rankingquestion{${e.question}}\n`;
- textex += "\\rankinganswersstart\n";
const a = e.answers;
for (let i = 0; i < 3; i++) {
textex += `\\rankinganswer{${a[i].name} ${a[i].surname}}{${a[i].count}}\n`;
}
- textex += "\\rankinganswersstop\n";
+ textex += "\\end{itemize}";
+
+ if (ind == 17) {
+ textex += "\\clearpage";
+ textex += rankingEnd + rankingStart;
+ } else {
+ if ((ind + 1) % 3 == 0) textex += "\\\\\n";
+ else textex += "&\n";
+ }
});
+ textex += rankingEnd;
await fs.writeFile(__dirname + "/zeitung/parts/generated/ranking/teacher.tex", textex);
diff --git a/zeitung/parts/rankingtemplate.tex b/zeitung/parts/rankingtemplate.tex
index e223dd0..4b986a3 100644
--- a/zeitung/parts/rankingtemplate.tex
+++ b/zeitung/parts/rankingtemplate.tex
@@ -1,13 +1,7 @@
\providecommand\rankingquestion[1]{
- \textbf{#1}\\
+ \item \textbf{#1}
}
\providecommand\rankinganswer[2]{
- \textbf{#1}: #2\\
-}
-
-\providecommand\rankinganswersstart{
-}
-
-\providecommand\rankinganswersstop{
+ \item #1: #2
}