feat: render missing questions

This commit is contained in:
Tim Grelka
2025-08-29 00:30:06 +02:00
parent 3162d0d980
commit 439e554810
2 changed files with 87 additions and 73 deletions
+30 -23
View File
@@ -54,6 +54,16 @@
align-items: start; align-items: start;
} }
.question.layout-not-found {
background: #f88;
}
.question.layout-not-found .question-text {
margin-bottom: 1ex;
}
.question.layout-not-found .answers {
display: none;
}
.question.layout-2 .answers, .question.layout-2 .answers,
.question.layout-6 .answers, .question.layout-6 .answers,
.question.layout-8 .answers { .question.layout-8 .answers {
@@ -82,10 +92,10 @@
display: none; display: none;
} }
.question .answers button.correct { .question .answers button.correct {
background: #3BB583; background: #3bb583;
} }
.question .answers button.wrong { .question .answers button.wrong {
background: #FE756C; background: #fe756c;
} }
.question .answers button.correct .result, .question .answers button.correct .result,
@@ -131,7 +141,7 @@ figcaption {
} }
.qso_own:after { .qso_own:after {
content: ' '; content: " ";
position: absolute; position: absolute;
width: 0; width: 0;
height: 0; height: 0;
@@ -144,7 +154,7 @@ figcaption {
} }
.qso_other:after { .qso_other:after {
content: ' '; content: " ";
position: absolute; position: absolute;
width: 0; width: 0;
height: 0; height: 0;
@@ -156,8 +166,10 @@ figcaption {
border-color: #ddd transparent transparent transparent; border-color: #ddd transparent transparent transparent;
} }
p,
p, li, tr, td { li,
tr,
td {
hyphens: auto; hyphens: auto;
-webkit-hyphens: auto; -webkit-hyphens: auto;
text-align: justify; text-align: justify;
@@ -191,7 +203,6 @@ footer {
clear: right; clear: right;
} }
span.morse { span.morse {
font-size: 33%; font-size: 33%;
position: relative; position: relative;
@@ -215,14 +226,14 @@ span.formula {
.info_alpha { .info_alpha {
margin-bottom: 2ex; margin-bottom: 2ex;
padding: 2ex; padding: 2ex;
background: #FF756D; background: #ff756d;
color: #fff; color: #fff;
} }
.info_beta { .info_beta {
margin-bottom: 2ex; margin-bottom: 2ex;
padding: 2ex; padding: 2ex;
background: #B8EAFF; background: #b8eaff;
} }
.info_beta a { .info_beta a {
@@ -250,7 +261,6 @@ span.formula {
width: 100%; width: 100%;
} }
.course .margin p, .course .margin p,
.course .margin ul.list, .course .margin ul.list,
.course .margin ol.list { .course .margin ol.list {
@@ -271,7 +281,6 @@ span.formula {
} }
@media (max-width: 800px) { @media (max-width: 800px) {
.course .margin { .course .margin {
margin-top: 4ex; margin-top: 4ex;
margin-bottom: 4ex; margin-bottom: 4ex;
@@ -281,7 +290,7 @@ span.formula {
.course .margin em { .course .margin em {
font-style: normal; font-style: normal;
font-weight: 600; font-weight: 600;
color: #2AA6DA; color: #2aa6da;
} }
.course .tip p, .course .tip p,
@@ -306,7 +315,6 @@ span.formula {
margin-bottom: 0.5ex; margin-bottom: 0.5ex;
} }
.course .margin.tip, .course .margin.tip,
.course .margin.unit, .course .margin.unit,
.course .margin.indepth, .course .margin.indepth,
@@ -317,22 +325,22 @@ span.formula {
} }
.course .margin.tip { .course .margin.tip {
border-left-color: #2AA6DA; border-left-color: #2aa6da;
} }
.course .margin.tip:before { .course .margin.tip:before {
content: "Tipp"; content: "Tipp";
background-color: #B8EAFF; background-color: #b8eaff;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M440-280h80v-240h-80v240Zm40-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>'); background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M440-280h80v-240h-80v240Zm40-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>');
} }
.course .margin.unit { .course .margin.unit {
border-left-color: #40C08C; border-left-color: #40c08c;
} }
.course .margin.unit:before { .course .margin.unit:before {
content: "Neue Einheit"; content: "Neue Einheit";
background-color: #B5E8D3; background-color: #b5e8d3;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M208-120q-37 0-62.5-25.5T120-208v-548q0-29 27-40.5t47 8.5l90 90-54 54 28 28 54-54 104 104-54 54 28 28 54-54 104 104-54 54 28 28 54-54 104 104-54 54 28 28 54-54 80 80q20 20 8.5 47T756-120H208Zm32-120h332L240-572v332Z"/></svg>'); background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M208-120q-37 0-62.5-25.5T120-208v-548q0-29 27-40.5t47 8.5l90 90-54 54 28 28 54-54 104 104-54 54 28 28 54-54 104 104-54 54 28 28 54-54 104 104-54 54 28 28 54-54 80 80q20 20 8.5 47T756-120H208Zm32-120h332L240-572v332Z"/></svg>');
} }
@@ -343,22 +351,22 @@ background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/200
} }
.course .margin.attention { .course .margin.attention {
border-left-color: #FFB300; border-left-color: #ffb300;
} }
.course .margin.attention:before { .course .margin.attention:before {
content: "Achtung"; content: "Achtung";
background-color: #FFE5A9; background-color: #ffe5a9;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm-40-160h80v-240h-80v240Zm40 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>'); background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm-40-160h80v-240h-80v240Zm40 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>');
} }
.course .margin.danger { .course .margin.danger {
border-left-color: #FF756D; border-left-color: #ff756d;
} }
.course .margin.danger:before { .course .margin.danger:before {
content: "Gefahr"; content: "Gefahr";
background-color: #FFCFCC; background-color: #ffcfcc;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m40-120 440-760 440 760H40Zm138-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm-40-120h80v-200h-80v200Zm40-100Z"/></svg>'); background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m40-120 440-760 440 760H40Zm138-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm-40-120h80v-200h-80v200Zm40-100Z"/></svg>');
} }
@@ -375,7 +383,7 @@ background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/200
width: 4em; width: 4em;
display: inline-block; display: inline-block;
padding: 6px 12px; padding: 6px 12px;
background: #00ADEF; background: #00adef;
color: #fff; color: #fff;
border-radius: 3px 0 0 3px; border-radius: 3px 0 0 3px;
text-align: right; text-align: right;
@@ -407,4 +415,3 @@ background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/200
.answers button:nth-child(4):before { .answers button:nth-child(4):before {
content: "D:"; content: "D:";
} }
+8 -1
View File
@@ -57,8 +57,15 @@ class Build:
metadata = json.load(file) metadata = json.load(file)
number = metadata[f"{input}"]["number"] # Fragennummer z.B. AB123 number = metadata[f"{input}"]["number"] # Fragennummer z.B. AB123
question = self.questions[number] if f"{input}" in metadata:
metadata = metadata[f"{input}"] metadata = metadata[f"{input}"]
number = metadata["number"] # Fragennummer z.B. AB123
question = self.questions[number]
else:
tqdm.write(f"\033[31mQuestion {input} is missing\033[0m")
metadata = {"layout": "not-found", "picture_a": ""}
number = 404
question = {"question": f"Frage {input} nicht gefunden"}
if "answer_a" in question: if "answer_a" in question:
answers = [question["answer_a"], question["answer_b"], question["answer_c"], question["answer_d"]] answers = [question["answer_a"], question["answer_b"], question["answer_c"], question["answer_d"]]