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
+78 -71
View File
@@ -54,10 +54,20 @@
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-6 .answers,
.question.layout-8 .answers {
grid-template-columns: repeat(2, calc(50% - 1ex/2));
grid-template-columns: repeat(2, calc(50% - 1ex / 2));
}
.question .answers button {
@@ -82,10 +92,10 @@
display: none;
}
.question .answers button.correct {
background: #3BB583;
background: #3bb583;
}
.question .answers button.wrong {
background: #FE756C;
background: #fe756c;
}
.question .answers button.correct .result,
@@ -130,34 +140,36 @@ figcaption {
margin-left: calc(40px + 10%);
}
.qso_own:after{
content: ' ';
position: absolute;
width: 0;
height: 0;
.qso_own:after {
content: " ";
position: absolute;
width: 0;
height: 0;
left: -20px;
right: auto;
right: auto;
top: 0px;
bottom: auto;
border: 22px solid;
border-color: #ddd transparent transparent transparent;
bottom: auto;
border: 22px solid;
border-color: #ddd transparent transparent transparent;
}
.qso_other:after{
content: ' ';
position: absolute;
width: 0;
height: 0;
.qso_other:after {
content: " ";
position: absolute;
width: 0;
height: 0;
left: auto;
right: -20px;
right: -20px;
top: 0px;
bottom: auto;
border: 20px solid;
border-color: #ddd transparent transparent transparent;
bottom: auto;
border: 20px solid;
border-color: #ddd transparent transparent transparent;
}
p, li, tr, td {
p,
li,
tr,
td {
hyphens: auto;
-webkit-hyphens: auto;
text-align: justify;
@@ -191,7 +203,6 @@ footer {
clear: right;
}
span.morse {
font-size: 33%;
position: relative;
@@ -215,14 +226,14 @@ span.formula {
.info_alpha {
margin-bottom: 2ex;
padding: 2ex;
background: #FF756D;
background: #ff756d;
color: #fff;
}
.info_beta {
margin-bottom: 2ex;
padding: 2ex;
background: #B8EAFF;
background: #b8eaff;
}
.info_beta a {
@@ -235,7 +246,7 @@ span.formula {
.course .table,
.course ul.list,
.course ol.list {
width: 59.3%;
width: 59.3%;
}
.course .margin {
@@ -250,11 +261,10 @@ span.formula {
width: 100%;
}
.course .margin p,
.course .margin ul.list,
.course .margin ol.list {
width: auto;
width: auto;
}
.margin .photo,
@@ -271,17 +281,16 @@ span.formula {
}
@media (max-width: 800px) {
.course .margin {
margin-top: 4ex;
margin-bottom: 4ex;
}
.course .margin {
margin-top: 4ex;
margin-bottom: 4ex;
}
}
.course .margin em {
font-style: normal;
font-weight: 600;
color: #2AA6DA;
color: #2aa6da;
}
.course .tip p,
@@ -297,43 +306,42 @@ span.formula {
.course .margin.indepth:before,
.course .margin.attention:before,
.course .margin.danger:before {
background-position: left bottom;
background-repeat: no-repeat;
background-size: contain;
display: block;
padding: 0.4ex 0 0.4ex 4ex;
line-height: 133%;
margin-bottom: 0.5ex;
background-position: left bottom;
background-repeat: no-repeat;
background-size: contain;
display: block;
padding: 0.4ex 0 0.4ex 4ex;
line-height: 133%;
margin-bottom: 0.5ex;
}
.course .margin.tip,
.course .margin.unit,
.course .margin.indepth,
.course .margin.attention,
.course .margin.danger {
border-left: 5px solid #bbb;
padding-left: 0.5em;
border-left: 5px solid #bbb;
padding-left: 0.5em;
}
.course .margin.tip {
border-left-color: #2AA6DA;
border-left-color: #2aa6da;
}
.course .margin.tip:before {
content: "Tipp";
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>');
content: "Tipp";
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>');
}
.course .margin.unit {
border-left-color: #40C08C;
border-left-color: #40c08c;
}
.course .margin.unit:before {
content: "Neue Einheit";
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>');
content: "Neue Einheit";
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>');
}
.course .margin.indepth:before {
@@ -343,48 +351,48 @@ background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/200
}
.course .margin.attention {
border-left-color: #FFB300;
border-left-color: #ffb300;
}
.course .margin.attention:before {
content: "Achtung";
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>');
content: "Achtung";
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>');
}
.course .margin.danger {
border-left-color: #FF756D;
border-left-color: #ff756d;
}
.course .margin.danger:before {
content: "Gefahr";
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>');
content: "Gefahr";
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>');
}
.course-toc,
.chapter-toc {
width: 600px;
max-width: calc(100vw - 20px);
width: 600px;
max-width: calc(100vw - 20px);
}
.course-toc .btn-label,
.chapter-toc .btn-label {
position: relative;
left: -12px;
left: -12px;
width: 4em;
display: inline-block;
padding: 6px 12px;
background: #00ADEF;
display: inline-block;
padding: 6px 12px;
background: #00adef;
color: #fff;
border-radius: 3px 0 0 3px;
border-radius: 3px 0 0 3px;
text-align: right;
}
.course-toc .btn-labeled,
.chapter-toc .btn-labeled {
padding-top: 0;
padding-bottom: 0;
padding-top: 0;
padding-bottom: 0;
text-align: left;
}
@@ -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 {
content: "D:";
}
+9 -2
View File
@@ -57,8 +57,15 @@ class Build:
metadata = json.load(file)
number = metadata[f"{input}"]["number"] # Fragennummer z.B. AB123
question = self.questions[number]
metadata = metadata[f"{input}"]
if f"{input}" in metadata:
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:
answers = [question["answer_a"], question["answer_b"], question["answer_c"], question["answer_d"]]