mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2025-12-16 23:50:12 +01:00
feat: Add include/exclude card lists feature with web UI, validation, fuzzy matching, and JSON persistence (ALLOW_MUST_HAVES=1)
This commit is contained in:
parent
7ef45252f7
commit
0516260304
39 changed files with 3672 additions and 626 deletions
|
|
@ -76,13 +76,14 @@ def start_ctx_from_session(sess: dict, *, set_on_session: bool = True) -> Dict[s
|
|||
tag_mode=sess.get("tag_mode", "AND"),
|
||||
use_owned_only=use_owned,
|
||||
prefer_owned=prefer,
|
||||
owned_names=owned_names_list,
|
||||
owned_names=owned_names_list,
|
||||
locks=list(sess.get("locks", [])),
|
||||
custom_export_base=sess.get("custom_export_base"),
|
||||
multi_copy=sess.get("multi_copy"),
|
||||
prefer_combos=bool(sess.get("prefer_combos")),
|
||||
combo_target_count=int(sess.get("combo_target_count", 2)),
|
||||
combo_balance=str(sess.get("combo_balance", "mix")),
|
||||
exclude_cards=sess.get("exclude_cards"),
|
||||
)
|
||||
if set_on_session:
|
||||
sess["build_ctx"] = ctx
|
||||
|
|
|
|||
|
|
@ -1377,6 +1377,7 @@ def start_build_ctx(
|
|||
prefer_combos: bool | None = None,
|
||||
combo_target_count: int | None = None,
|
||||
combo_balance: str | None = None,
|
||||
exclude_cards: List[str] | None = None,
|
||||
) -> Dict[str, Any]:
|
||||
logs: List[str] = []
|
||||
|
||||
|
|
@ -1449,6 +1450,19 @@ def start_build_ctx(
|
|||
b.setup_dataframes()
|
||||
# Apply the same global pool pruning in interactive builds for consistency
|
||||
_global_prune_disallowed_pool(b)
|
||||
|
||||
# Apply exclude cards (M0.5: Phase 1 - Exclude Only)
|
||||
try:
|
||||
if exclude_cards:
|
||||
b.exclude_cards = list(exclude_cards)
|
||||
# The filtering is already applied in setup_dataframes(), but we need
|
||||
# to call it again after setting exclude_cards
|
||||
b._combined_cards_df = None # Clear cache to force rebuild
|
||||
b.setup_dataframes() # This will now apply the exclude filtering
|
||||
out(f"Applied exclude filtering for {len(exclude_cards)} patterns")
|
||||
except Exception as e:
|
||||
out(f"Failed to apply exclude cards: {e}")
|
||||
|
||||
# Thread multi-copy selection onto builder for stage generation/runner
|
||||
try:
|
||||
b._web_multi_copy = (multi_copy or None)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue