feat: app.py checks wizard_complete flag to gate main app
This commit is contained in:
parent
1a74793804
commit
fd215a22f6
2 changed files with 23 additions and 1 deletions
|
|
@ -65,7 +65,11 @@ _startup()
|
|||
from scripts.user_profile import UserProfile as _UserProfile
|
||||
_USER_YAML = Path(__file__).parent.parent / "config" / "user.yaml"
|
||||
|
||||
if not _UserProfile.exists(_USER_YAML):
|
||||
_show_wizard = (
|
||||
not _UserProfile.exists(_USER_YAML)
|
||||
or not _UserProfile(_USER_YAML).wizard_complete
|
||||
)
|
||||
if _show_wizard:
|
||||
_setup_page = st.Page("pages/0_Setup.py", title="Setup", icon="👋")
|
||||
st.navigation({"": [_setup_page]}).run()
|
||||
st.stop()
|
||||
|
|
@ -114,6 +118,8 @@ def _task_indicator():
|
|||
label = "Enriching"
|
||||
elif task_type == "scrape_url":
|
||||
label = "Scraping URL"
|
||||
elif task_type == "wizard_generate":
|
||||
label = "Wizard generation"
|
||||
elif task_type == "enrich_craigslist":
|
||||
label = "Enriching listing"
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -21,3 +21,19 @@ def test_wizard_gating_empty_file_still_exists(tmp_path):
|
|||
p = tmp_path / "user.yaml"
|
||||
p.write_text("")
|
||||
assert UserProfile.exists(p)
|
||||
|
||||
|
||||
def test_wizard_incomplete_triggers_wizard(tmp_path):
|
||||
"""wizard_complete: false should be treated as 'wizard not done'."""
|
||||
p = tmp_path / "user.yaml"
|
||||
p.write_text("name: T\nemail: t@t.com\ncareer_summary: x\nwizard_complete: false\n")
|
||||
from scripts.user_profile import UserProfile
|
||||
u = UserProfile(p)
|
||||
assert u.wizard_complete is False
|
||||
|
||||
def test_wizard_complete_does_not_trigger(tmp_path):
|
||||
p = tmp_path / "user.yaml"
|
||||
p.write_text("name: T\nemail: t@t.com\ncareer_summary: x\nwizard_complete: true\n")
|
||||
from scripts.user_profile import UserProfile
|
||||
u = UserProfile(p)
|
||||
assert u.wizard_complete is True
|
||||
|
|
|
|||
Loading…
Reference in a new issue