forked from d101tm/tmstats
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeinitialworkingalignment.py
More file actions
executable file
·62 lines (51 loc) · 1.41 KB
/
makeinitialworkingalignment.py
File metadata and controls
executable file
·62 lines (51 loc) · 1.41 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
#!/usr/bin/env python3
""" Copy current club information to working alignment CSV file
Creates a CSV with the proper headers and information based on current
clubs.
You must copy that CSV into the Google Spreadsheet used by the alignment
committee to hold the working alignment.
"""
import tmglobals
import tmparms
from simpleclub import Club
from overridepositions import overrideClubPositions
# Establish parameters
parms = tmparms.tmparms()
# Add other parameters here
# Do global setup
myglobals = tmglobals.tmglobals()
myglobals.setup(parms)
curs = myglobals.curs
conn = myglobals.conn
headers = [
"clubnumber",
"clubname",
"oldarea",
"newarea",
"likelytoclose",
"color",
"goalsmet",
"activemembers",
"onlineonly",
"meetingday",
"meetingtime",
"place",
"address",
"city",
"state",
"zip",
"country",
"latitude",
"longitude"
]
print(','.join(headers))
# Get current club information from the clubperf file - that will include hidden and suspended clubs.
curs.execute('SELECT clubnumber, clubname, division, area FROM clubperf WHERE entrytype = "L"')
clubs = []
for club in curs.fetchall():
clubs.append((club[0], club[1], club[2]+club[3]))
# Sort by area
clubs.sort(key=lambda club:club[2])
# And print
for club in clubs:
print(f'{club[0]},"{club[1]}",{club[2]}')