Resolve "Демо-сценарий end-to-end" - #109
Merged
Merged
Conversation
- seed_demo: augments imported objects with believable wear + ONE fresh inspection for a deterministic majority (default 88%), so recompute yields a realistic spread instead of 'almost all overdue/repair'; minority left as the attention/overdue tail; idempotent (demo inspections tagged + re-created) - create_demo_users: idempotent accounts per role (viewer/engineer/manager/admin, admin = superuser) with fixed known passwords; resets password if user exists; prints a login/password/role table - bootstrap_demo: one command — reference -> import -> hydropost history -> seed_demo -> recompute -> demo users (import steps skipped gracefully if raw datasets absent) - README: one-command bring-up, live demo link, demo-accounts table, show script Verified on a clone of the real dataset (1432 objects): before 1145/1432 overdue, repair-heavy; after serviceable=566 monitoring=422 repair=304 emergency=140, overdue 266. All 4 demo logins return correct roles; engineer submits (can't decide, 403), manager approves -> order PDF (200); /admin/ up; idempotent re-runs.
Resolve "Демо-сценарий end-to-end"
…ploy seed_demo) main already has a seed_demo (creates compact demo objects for the live deploy's Helm seed-Job). Rename this realistic-inspection seeder to seed_demo_state so both coexist; bootstrap_demo calls seed_demo_state, and falls back to seed_demo to create objects when --skip-import is used.
fix(#34): rename seed_demo_state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #34
Что сделано
Финальная интеграция M6: данные каталога приведены к правдоподобному виду для защиты, добавлены детерминированные демо-аккаунты по ролям и одно-командный запуск демо; README описывает сценарий показа и ссылку на живое демо.
Основные изменения
seed_demo(catalog): дополняет импортированные объекты разумным износом и ОДНИМ свежим осмотром для детерминированного большинства (по умолчанию 88%), чтобы после пересчёта распределение по состояниям выглядело реалистично, а не «сплошь аварийным/просроченным»; меньшинство намеренно оставлено как «хвост» требующих внимания/просроченных. Идемпотентно (демо-осмотры помечены и пересоздаются), реальные данные импорта не удаляются.create_demo_users(accounts): идемпотентно создаёт по аккаунту на роль (viewer/engineer/manager/admin; admin — суперпользователь) с фиксированными паролями; если юзер есть — сбрасывает пароль и роль; печатает таблицу логин/пароль/роль.bootstrap_demo(catalog): одна команда — справочники → импорт открытых данных → история гидропостов →seed_demo→recompute_assessments→ демо-аккаунты; шаги импорта мягко пропускаются, если сырых датасетов нет.Зачем это сделано
Каталог из-за пустой/синтетической истории осмотров выглядел «всё аварийное и просрочено». Демо-сид делает картину достоверной (большинство исправно/под наблюдением, меньшинство в ремонте/аварии), а единая команда и аккаунты дают воспроизводимый сквозной демо-сценарий для защиты.
Тестирование
Проверено на копии реального датасета (1432 объекта): до — 1145/1432 просрочено, перекос в repair; после демо-сида — serviceable=566, monitoring=422, repair=304, emergency=140, просрочено 266. Все 4 демо-входа дают корректную роль; инженер подаёт заявку (decide → 403), менеджер согласует → PDF-приказ (HTTP 200);
/admin/поднимается; повторные запуски идемпотентны.