refactor(prezentacja): wspólne partiale formularza — koniec dublowania chart/compile
Testy / Testy warstwy logicznej (silnik) (pull_request) Successful in 10m32s
Testy / Testy warstwy prezentacji (dostęp do baz) (pull_request) Successful in 9m28s
Testy / Build obrazu silnika B (swisseph) (pull_request) Successful in 12s
Testy / Kontrola składni wszystkich warstw (pull_request) Successful in 8s
build / build (push) Successful in 20s
Testy / Testy warstwy logicznej (silnik) (push) Successful in 10m28s
Testy / Testy warstwy prezentacji (dostęp do baz) (push) Successful in 9m29s
Testy / Build obrazu silnika B (swisseph) (push) Successful in 11s
Testy / Kontrola składni wszystkich warstw (push) Successful in 8s
Testy / Testy warstwy logicznej (silnik) (pull_request) Successful in 10m32s
Testy / Testy warstwy prezentacji (dostęp do baz) (pull_request) Successful in 9m28s
Testy / Build obrazu silnika B (swisseph) (pull_request) Successful in 12s
Testy / Kontrola składni wszystkich warstw (pull_request) Successful in 8s
build / build (push) Successful in 20s
Testy / Testy warstwy logicznej (silnik) (push) Successful in 10m28s
Testy / Testy warstwy prezentacji (dostęp do baz) (push) Successful in 9m29s
Testy / Build obrazu silnika B (swisseph) (push) Successful in 11s
Testy / Kontrola składni wszystkich warstw (push) Successful in 8s
Spłata długu: bloki opcji i tabele wyniku były kopiowane między „Horoskop" (/) i „Skompiluj" (/compile). Duplikat już raz spowodował regresję (podsumowanie gubiło opcje), a przy każdej nowej opcji rósł (dodawałem je 3× w dwóch miejscach). - `_form_options.html` (NOWY): bloki opcji — stacje/tabele, porównanie domów, ustawienia aspektów. Dołączany przez oba formularze. - `_result_tables.html`: chart.html PRZECHODZI na ten wspólny plik (compile już go używał od #46). Rysunki (koło/aspektarian/deklinacja/antyscja) zgrupowane razem, potem wspólne tabele. Dzięki temu widok główny i podsumowanie NIE MOGĄ się już rozjechać — jedno źródło prawdy. Zero zmian zachowania: oba szablony renderują te same pola i tabele co wcześniej (sprawdzone renderem na bogatym wyniku). Testy strukturalne przełączone na odczyt wspólnych plików. Prezentacja 221. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit was merged in pull request #50.
This commit is contained in:
@@ -10,6 +10,7 @@ import pathlib
|
||||
APP = pathlib.Path(__file__).resolve().parents[1] / "app"
|
||||
CHART = (APP / "templates" / "chart.html").read_text(encoding="utf-8")
|
||||
COMPILE = (APP / "templates" / "compile.html").read_text(encoding="utf-8")
|
||||
OPTS = (APP / "templates" / "_form_options.html").read_text(encoding="utf-8") # wspólne opcje obu formularzy
|
||||
MAIN = (APP / "main.py").read_text(encoding="utf-8")
|
||||
CLIENT = (APP / "clients" / "logic_client.py").read_text(encoding="utf-8")
|
||||
SYNC = (APP / "static" / "formsync.js").read_text(encoding="utf-8")
|
||||
@@ -19,9 +20,11 @@ FIELDS = ("aspect_orb", "aspect_luminary_bonus", "aspect_minor")
|
||||
|
||||
|
||||
def test_both_forms_have_aspect_settings():
|
||||
"""Pola są we WSPÓLNYM pliku opcji, który oba formularze dołączają."""
|
||||
for f in FIELDS:
|
||||
assert f'name="{f}"' in CHART, f"Horoskop: brak {f}"
|
||||
assert f'name="{f}"' in COMPILE, f"Skompiluj: brak {f}"
|
||||
assert f'name="{f}"' in OPTS, f"brak {f} we wspólnym pliku opcji"
|
||||
assert '{% include "_form_options.html" %}' in CHART
|
||||
assert '{% include "_form_options.html" %}' in COMPILE
|
||||
|
||||
|
||||
def test_handlers_accept_and_pass_aspect_settings():
|
||||
|
||||
@@ -167,9 +167,11 @@ def test_does_nothing_on_other_tabs():
|
||||
# porównania domów, więc podsumowanie miało braki względem tego, co policzono.
|
||||
|
||||
def test_compile_form_carries_the_options():
|
||||
"""Te same opcje co „Horoskop" (synchronizowane) — inaczej nie da się ich przekazać."""
|
||||
"""Te same opcje co „Horoskop" — z WSPÓLNEGO pliku (formsync je synchronizuje)."""
|
||||
assert '{% include "_form_options.html" %}' in TPL
|
||||
opts = (APP / "templates" / "_form_options.html").read_text(encoding="utf-8")
|
||||
for f in ('name="stations"', 'name="tables"', 'name="house_systems"'):
|
||||
assert f in TPL, f"brak opcji w formularzu podsumowania: {f}"
|
||||
assert f in opts, f"brak opcji we wspólnym pliku: {f}"
|
||||
|
||||
|
||||
def test_compile_handler_recomputes_with_all_options():
|
||||
|
||||
@@ -7,14 +7,23 @@ import pathlib
|
||||
|
||||
APP = pathlib.Path(__file__).resolve().parents[1] / "app"
|
||||
CHART = (APP / "templates" / "chart.html").read_text(encoding="utf-8")
|
||||
COMPILE = (APP / "templates" / "compile.html").read_text(encoding="utf-8")
|
||||
OPTS = (APP / "templates" / "_form_options.html").read_text(encoding="utf-8") # wspólne opcje
|
||||
TABLES = (APP / "templates" / "_result_tables.html").read_text(encoding="utf-8") # wspólne tabele
|
||||
MAIN = (APP / "main.py").read_text(encoding="utf-8")
|
||||
CLIENT = (APP / "clients" / "logic_client.py").read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_both_forms_use_shared_option_partial():
|
||||
"""Opcje w jednym pliku — oba formularze go dołączają (koniec duplikacji)."""
|
||||
assert '{% include "_form_options.html" %}' in CHART
|
||||
assert '{% include "_form_options.html" %}' in COMPILE
|
||||
|
||||
|
||||
def test_form_lets_you_pick_extra_systems():
|
||||
"""Checkboxy dla trzech systemów — wielokrotny wybór (name powtórzony)."""
|
||||
for val in ("whole_sign", "equal", "porphyry"):
|
||||
assert f'name="house_systems" value="{val}"' in CHART, f"brak checkboxa {val}"
|
||||
assert f'name="house_systems" value="{val}"' in OPTS, f"brak checkboxa {val}"
|
||||
|
||||
|
||||
def test_handler_accepts_and_passes_house_systems():
|
||||
@@ -28,16 +37,16 @@ def test_client_forwards_house_systems_to_logic():
|
||||
|
||||
def test_comparison_table_renders_only_for_multiple_systems():
|
||||
"""Bez dodatkowych systemów nie pokazujemy pustej tabeli porównania."""
|
||||
assert "result.house_systems | length > 1" in CHART
|
||||
assert "Porównanie systemów domów" in CHART
|
||||
assert "result.house_systems | length > 1" in TABLES
|
||||
assert "Porównanie systemów domów" in TABLES
|
||||
|
||||
|
||||
def test_comparison_table_shows_cusp_per_system():
|
||||
"""Tabela iteruje po systemach i po 12 domach — kusp w każdej komórce."""
|
||||
assert "for hs in result.house_systems" in CHART
|
||||
assert "hs.cusps[i].in_sign" in CHART
|
||||
assert "for hs in result.house_systems" in TABLES
|
||||
assert "hs.cusps[i].in_sign" in TABLES
|
||||
|
||||
|
||||
def test_checkbox_state_survives_submit():
|
||||
"""Zaznaczone systemy zostają zaznaczone po przeliczeniu."""
|
||||
assert "in chosen" in CHART and "form.house_systems" in CHART
|
||||
assert "in chosen" in OPTS and "form.house_systems" in OPTS
|
||||
|
||||
Reference in New Issue
Block a user