mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2026-04-05 20:57:16 +02:00
feat: smart land bases — auto land count, mana profile, slot earmarking, and backfill (#63)
This commit is contained in:
parent
ac6c9f4daa
commit
0ab2183277
21 changed files with 1408 additions and 51 deletions
|
|
@ -1,7 +1,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from fastapi import APIRouter, Request, Query
|
||||
from fastapi.responses import HTMLResponse
|
||||
from fastapi.responses import HTMLResponse, JSONResponse
|
||||
from typing import Any
|
||||
import json
|
||||
from urllib.parse import urlparse
|
||||
|
|
@ -228,3 +228,20 @@ def batch_build_progress(request: Request, batch_id: str = Query(...)):
|
|||
# - POST /build/enforce/apply - Apply enforcement
|
||||
# - GET /build/enforcement - Full-page enforcement
|
||||
# ==============================================================================
|
||||
|
||||
|
||||
@router.get("/land-diagnostics")
|
||||
async def land_diagnostics(request: Request) -> JSONResponse:
|
||||
"""Return the smart-land analysis report for the active build session.
|
||||
|
||||
Reads _land_report_data produced by LandAnalysisMixin (Roadmap 14).
|
||||
Returns 204 when ENABLE_SMART_LANDS is off or no build is in session.
|
||||
"""
|
||||
sid = request.cookies.get("sid") or ""
|
||||
sess = get_session(sid)
|
||||
from ..services.land_optimization_service import LandOptimizationService
|
||||
svc = LandOptimizationService()
|
||||
report = svc.get_land_report(sess)
|
||||
if not report:
|
||||
return JSONResponse({}, status_code=204)
|
||||
return JSONResponse(svc.format_for_api(report))
|
||||
|
|
|
|||
|
|
@ -511,6 +511,7 @@ async def build_new_submit(
|
|||
"enable_custom_themes": ENABLE_CUSTOM_THEMES,
|
||||
"enable_batch_build": ENABLE_BATCH_BUILD,
|
||||
"enable_budget_mode": ENABLE_BUDGET_MODE,
|
||||
"ideals_ui_mode": WEB_IDEALS_UI,
|
||||
"multi_copy_archetypes_js": _ARCHETYPE_JS_MAP,
|
||||
"form": _form_state(suggested),
|
||||
"tag_slot_html": None,
|
||||
|
|
@ -538,6 +539,7 @@ async def build_new_submit(
|
|||
"enable_custom_themes": ENABLE_CUSTOM_THEMES,
|
||||
"enable_batch_build": ENABLE_BATCH_BUILD,
|
||||
"enable_budget_mode": ENABLE_BUDGET_MODE,
|
||||
"ideals_ui_mode": WEB_IDEALS_UI,
|
||||
"multi_copy_archetypes_js": _ARCHETYPE_JS_MAP,
|
||||
"form": _form_state(commander),
|
||||
"tag_slot_html": None,
|
||||
|
|
@ -645,6 +647,7 @@ async def build_new_submit(
|
|||
"enable_custom_themes": ENABLE_CUSTOM_THEMES,
|
||||
"enable_batch_build": ENABLE_BATCH_BUILD,
|
||||
"enable_budget_mode": ENABLE_BUDGET_MODE,
|
||||
"ideals_ui_mode": WEB_IDEALS_UI,
|
||||
"multi_copy_archetypes_js": _ARCHETYPE_JS_MAP,
|
||||
"form": _form_state(primary_commander_name),
|
||||
"tag_slot_html": tag_slot_html,
|
||||
|
|
@ -786,6 +789,7 @@ async def build_new_submit(
|
|||
"enable_custom_themes": ENABLE_CUSTOM_THEMES,
|
||||
"enable_batch_build": ENABLE_BATCH_BUILD,
|
||||
"enable_budget_mode": ENABLE_BUDGET_MODE,
|
||||
"ideals_ui_mode": WEB_IDEALS_UI,
|
||||
"multi_copy_archetypes_js": _ARCHETYPE_JS_MAP,
|
||||
"form": _form_state(sess.get("commander", "")),
|
||||
"tag_slot_html": None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue