File size: 916 Bytes
30fa1aa
 
 
 
 
052adbf
 
30fa1aa
 
 
 
 
 
 
052adbf
30fa1aa
 
 
052adbf
 
 
 
30fa1aa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""Reset the demo data (stop the server first, or use the reset buttons on the QC page).

  python server/reset.py            -> ready     (today's high-waste menu planned; voice box opens when served)
  python server/reset.py full       -> full      (today's investigation meal served, voted and audited)
  python server/reset.py verified   -> verified  (the whole loop done, trial confirmed twice)

Refused when the database is in real-data mode (see server/data_mode.py).
"""
import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parent))

from db import LOCK  # noqa: E402
from seed import RealDataError, seed  # noqa: E402

preset = sys.argv[1] if len(sys.argv) > 1 and sys.argv[1] in ("ready", "full", "verified") else "ready"
with LOCK:
    try:
        seed(preset)
    except RealDataError as e:
        sys.exit(f"Not reset: {e}")
print(f"EatBack demo data reset: {preset}")