-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_sample.py
More file actions
64 lines (54 loc) · 1.96 KB
/
Copy pathcreate_sample.py
File metadata and controls
64 lines (54 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python3
"""
Create sample 'Nase firmy 2025' session
"""
import sys
sys.path.insert(0, '.')
from server import create_app
from models import db, VotingSession, Question, Team
def create_sample():
app = create_app()
with app.app_context():
# Check if sample session exists
existing = VotingSession.query.filter_by(name='Nase firmy 2025').first()
if existing:
print(f'Sample session already exists! ID: {existing.unique_id}')
return existing.unique_id
print('Creating sample "Nase firmy 2025" session...')
# Create voting session
session = VotingSession(
unique_id='655662',
name='Nase firmy 2025',
description='Annual company competition',
started=True,
ended=False
)
db.session.add(session)
db.session.flush()
# Add questions (categories)
categories = ['MASKA', 'KOLA', 'SKELET', 'PLAKAT', 'MARKETING']
for idx, category in enumerate(categories):
question = Question(
session_id=session.id,
text=category,
question_type='team_selection',
options=[],
order_index=idx
)
db.session.add(question)
# Add teams
teams = ['Tym Alpha', 'Tym Beta', 'Tym Gamma', 'Tym Delta']
for team_name in teams:
team = Team(
session_id=session.id,
name=team_name
)
db.session.add(team)
db.session.commit()
print('Sample session created successfully!')
print(f'Session ID: {session.unique_id}')
print(f'Voting URL: http://localhost:5000/hlasovani/{session.unique_id}')
print(f'QR Code URL: http://localhost:5000/presentation/{session.unique_id}')
return session.unique_id
if __name__ == '__main__':
create_sample()