Merge branch 'main' into fix/dbc
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
"use strict";
|
||||
|
||||
var COURSE_CHOICES = [
|
||||
{ edition: "SWL", label: "SWL-Kurs", detail: "Kurzwellenhören", color: "#FFFFFF" },
|
||||
{ edition: "N", label: "N-Kurs", detail: "N", color: "#47ABE8" },
|
||||
{ edition: "NE", label: "E-Kurs", detail: "N + E", color: "#FE756C" },
|
||||
{ edition: "NEA", label: "A-Kurs", detail: "N + E + A", color: "#3BB583" },
|
||||
|
||||
+12
-2
@@ -215,7 +215,7 @@ class Build:
|
||||
def __build_homework_tool(self):
|
||||
toc_target = self.config.p_build_assets / "toc"
|
||||
toc_target.mkdir(parents=True, exist_ok=True)
|
||||
for edition in ("SWL", "N", "NE", "NEA", "E", "EA", "A"):
|
||||
for edition in ("N", "NE", "NEA", "E", "EA", "A"):
|
||||
source = self.config.p_data_toc / f"{edition}.json"
|
||||
if not source.exists():
|
||||
source = self.config.p_data_toc / f"{edition.lower()}.json"
|
||||
@@ -228,7 +228,7 @@ class Build:
|
||||
page_scripts=[
|
||||
"assets/vue.global.prod.js",
|
||||
"assets/question-catalog.js?ts=20260806",
|
||||
"assets/homework.js?ts=202608061",
|
||||
"assets/homework.js?ts=202608271",
|
||||
],
|
||||
)
|
||||
with (self.config.p_build / "hausaufgabe.html").open("w", encoding="utf-8") as file:
|
||||
@@ -657,6 +657,16 @@ class Build:
|
||||
"editions": [],
|
||||
},
|
||||
)
|
||||
if edition != "SWL" and question_entry["editions"] == ["SWL"]:
|
||||
# SWL reuses questions from the regular courses, but can place
|
||||
# them in SWL-specific chapters. The question index exposes a
|
||||
# single canonical location, so prefer the first regular
|
||||
# course occurrence. Pure SWL questions keep their location.
|
||||
question_entry.update(
|
||||
section=section_ident,
|
||||
chapter_title=chapter_title,
|
||||
section_title=section_title,
|
||||
)
|
||||
if edition not in question_entry["editions"]:
|
||||
question_entry["editions"].append(edition)
|
||||
|
||||
|
||||
@@ -102,3 +102,47 @@ def test_lowercase_swl_toc_is_supported(tmp_path):
|
||||
build.build_edition("SWL")
|
||||
assert (tmp_path / "build" / "SWL_course_index.html").exists()
|
||||
assert (tmp_path / "build" / "SWL_swl_intro.html").exists()
|
||||
|
||||
|
||||
def test_regular_course_location_takes_precedence_for_shared_swl_question(tmp_path):
|
||||
prepare_content(tmp_path, include_swl=True)
|
||||
build = Build(Config(content_path=tmp_path, build_path=tmp_path / "build"))
|
||||
|
||||
build._Build__collect_question_occurrences(
|
||||
"SWL",
|
||||
"SWL-Kapitel",
|
||||
"swl_buchstabieralphabet",
|
||||
"SWL-Buchstabieralphabet",
|
||||
"[question:NA101]",
|
||||
)
|
||||
build._Build__collect_question_occurrences(
|
||||
"N",
|
||||
"Erste Schritte",
|
||||
"buchstabiertafel",
|
||||
"Internationale Buchstabiertafel",
|
||||
"[question:NA101]",
|
||||
)
|
||||
|
||||
assert build.question_index["NA101"] == {
|
||||
"has_solution": False,
|
||||
"section": "buchstabiertafel",
|
||||
"chapter_title": "Erste Schritte",
|
||||
"section_title": "Internationale Buchstabiertafel",
|
||||
"editions": ["SWL", "N"],
|
||||
}
|
||||
|
||||
|
||||
def test_pure_swl_question_keeps_its_swl_location(tmp_path):
|
||||
prepare_content(tmp_path, include_swl=True)
|
||||
build = Build(Config(content_path=tmp_path, build_path=tmp_path / "build"))
|
||||
|
||||
build._Build__collect_question_occurrences(
|
||||
"SWL",
|
||||
"SWL-Kapitel",
|
||||
"swl_eigene_fragen",
|
||||
"SWL-Fragen",
|
||||
"[question:SWL001]",
|
||||
)
|
||||
|
||||
assert build.question_index["SWL001"]["section"] == "swl_eigene_fragen"
|
||||
assert build.question_index["SWL001"]["editions"] == ["SWL"]
|
||||
|
||||
Reference in New Issue
Block a user