-
Notifications
You must be signed in to change notification settings - Fork 10
/
setup_waitlists.py
62 lines (51 loc) · 1.91 KB
/
setup_waitlists.py
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
# inject the lib folder before everything else
from waitlist.base import db
from waitlist.data.names import WaitlistNames
from waitlist.storage.database import Waitlist, WaitlistGroup
def create_default_waitlist_group():
group = create_waitlist_group("default", "HQ (Default)")
if group is None:
return
group.enabled = True
group.ordering = 0
def create_assault_waitlist_group():
group = create_waitlist_group("assault", "Assaults")
if group is None:
return
group.ordering = 1
def create_v_g_waitlist_group():
group = create_waitlist_group("vanguard", "Vanguards")
if group is None:
return
group.ordering = 2
def create_waitlist_group(group_name, display_name):
# lets check if this group exists
if db.session.query(WaitlistGroup).filter(WaitlistGroup.groupName == group_name).first() is not None:
print("Found Group ", group_name)
return None
xuplist = Waitlist(name=WaitlistNames.xup_queue, displayTitle="X-UP", waitlistType='xup')
logilist = Waitlist(name=WaitlistNames.logi, displayTitle="Logi", waitlistType='logi')
dpslist = Waitlist(name=WaitlistNames.dps, displayTitle="Dps", waitlistType='dps')
sniperlist = Waitlist(name=WaitlistNames.sniper, displayTitle="Sniper", waitlistType='sniper')
group = WaitlistGroup()
group.groupName = group_name
group.displayName = display_name
group.xuplist = xuplist
group.logilist = logilist
group.dpslist = dpslist
group.sniperlist = sniperlist
group.otherlist = None
group.enabled = False
db.session.add(group)
db.session.flush()
db.session.refresh(group)
xuplist.group = group
logilist.group = group
dpslist.group = group
sniperlist.group = group
return group
if __name__ == '__main__':
create_default_waitlist_group()
create_assault_waitlist_group()
create_v_g_waitlist_group()
db.session.commit()