feat: hide current calendar year from window dropdowns (covered by current_parliament)
This commit is contained in:
+22
-4
@@ -1416,7 +1416,16 @@ def build_compass_tab(db_path: str, window_size: str) -> None:
|
|||||||
active_mps = load_active_mps(db_path)
|
active_mps = load_active_mps(db_path)
|
||||||
|
|
||||||
# Sort windows: year windows first (ascending), current_parliament last.
|
# Sort windows: year windows first (ascending), current_parliament last.
|
||||||
year_windows = sorted(w for w in positions_by_window if w != "current_parliament")
|
# Exclude the current calendar year — it is already fully covered by current_parliament
|
||||||
|
# and showing both creates confusion (2026 ⊂ current_parliament).
|
||||||
|
import datetime as _dt
|
||||||
|
|
||||||
|
_current_year = str(_dt.date.today().year)
|
||||||
|
year_windows = sorted(
|
||||||
|
w
|
||||||
|
for w in positions_by_window
|
||||||
|
if w != "current_parliament" and w != _current_year
|
||||||
|
)
|
||||||
has_current = "current_parliament" in positions_by_window
|
has_current = "current_parliament" in positions_by_window
|
||||||
windows = year_windows + (["current_parliament"] if has_current else [])
|
windows = year_windows + (["current_parliament"] if has_current else [])
|
||||||
|
|
||||||
@@ -2568,9 +2577,14 @@ def build_svd_components_tab(db_path: str) -> None:
|
|||||||
# Default party scores already loaded earlier for sidebar controls.
|
# Default party scores already loaded earlier for sidebar controls.
|
||||||
# ALL components 1-10 use raw (non-aligned) SVD vectors.
|
# ALL components 1-10 use raw (non-aligned) SVD vectors.
|
||||||
# The compass uses Procrustes-aligned PCA — separate visualization.
|
# The compass uses Procrustes-aligned PCA — separate visualization.
|
||||||
# Get available windows from svd_vectors
|
# Get available windows from svd_vectors; exclude current year (covered by current_parliament)
|
||||||
|
import datetime as _dt
|
||||||
|
|
||||||
|
_current_year = str(_dt.date.today().year)
|
||||||
available_windows = get_uniform_dim_windows(db_path)
|
available_windows = get_uniform_dim_windows(db_path)
|
||||||
year_windows = sorted(w for w in available_windows if w != "current_parliament")
|
year_windows = sorted(
|
||||||
|
w for w in available_windows if w != "current_parliament" and w != _current_year
|
||||||
|
)
|
||||||
has_current = "current_parliament" in available_windows
|
has_current = "current_parliament" in available_windows
|
||||||
svd_windows = year_windows + (["current_parliament"] if has_current else [])
|
svd_windows = year_windows + (["current_parliament"] if has_current else [])
|
||||||
|
|
||||||
@@ -2718,7 +2732,11 @@ def build_svd_components_tab(db_path: str) -> None:
|
|||||||
if view_mode == "Tijdtraject" and selected_parties_for_trajectory:
|
if view_mode == "Tijdtraject" and selected_parties_for_trajectory:
|
||||||
# Load party scores for all windows and render time trajectory
|
# Load party scores for all windows and render time trajectory
|
||||||
available_windows = get_uniform_dim_windows(db_path)
|
available_windows = get_uniform_dim_windows(db_path)
|
||||||
year_windows = sorted(w for w in available_windows if w != "current_parliament")
|
year_windows = sorted(
|
||||||
|
w
|
||||||
|
for w in available_windows
|
||||||
|
if w != "current_parliament" and w != _current_year
|
||||||
|
)
|
||||||
has_current = "current_parliament" in available_windows
|
has_current = "current_parliament" in available_windows
|
||||||
all_windows = year_windows + (["current_parliament"] if has_current else [])
|
all_windows = year_windows + (["current_parliament"] if has_current else [])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user