-
Notifications
You must be signed in to change notification settings - Fork 0
/
sponsor.py
130 lines (123 loc) · 5.38 KB
/
sponsor.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
from google.appengine.ext import ndb
class Sponsor(ndb.Model):
sponsor_id = ndb.IntegerProperty(default = 0)
first_name = ndb.StringProperty(default = '')
last_name = ndb.StringProperty(default = '')
sort_name = ndb.StringProperty(default = '')
company = ndb.StringProperty(default = '')
address = ndb.StringProperty(default = '')
city = ndb.StringProperty(default = '')
state = ndb.StringProperty(default = '')
zip = ndb.StringProperty(default = '')
phone = ndb.StringProperty(default = '')
fax = ndb.StringProperty(default = '')
email = ndb.StringProperty(default = '')
anonymous = ndb.BooleanProperty(default = False)
printed_names = ndb.StringProperty(default = '')
sponsorships = ndb.KeyProperty(repeated = True)
num_golfers = ndb.IntegerProperty(default = 0) # Golf + Dinner
num_golfers_no_dinner = ndb.IntegerProperty(default = 0) # Golf only
num_dinners = ndb.IntegerProperty(default = 0) # Dinner only
additional_donation = ndb.IntegerProperty(default = 0)
payment_due = ndb.IntegerProperty(default = 0)
discount = ndb.IntegerProperty(default = 0)
discount_type = ndb.StringProperty(default = '')
go_golfers = ndb.IntegerProperty(default = 0)
go_discount_code = ndb.StringProperty(default = '')
payment_made = ndb.IntegerProperty(default = 0)
payment_type = ndb.StringProperty(default = '')
transaction_code = ndb.StringProperty(default = '')
auth_code = ndb.StringProperty(default = '')
pairing = ndb.StringProperty(default = '')
dinner_seating = ndb.StringProperty(default = '')
timestamp = ndb.DateTimeProperty(auto_now_add = True)
confirmed = ndb.BooleanProperty(default = False) # Set after registration Step 2 completed.
ok_to_share_email = ndb.BooleanProperty(default = False)
golfer_keys = ndb.KeyProperty(repeated = True)
dinner_keys = ndb.KeyProperty(repeated = True)
class Team(ndb.Model):
name = ndb.StringProperty(default = '')
starting_hole = ndb.StringProperty(default = '')
flight = ndb.IntegerProperty(default = 1)
golfers = ndb.KeyProperty(repeated = True)
pairing = ndb.StringProperty(default = '')
class Golfer(ndb.Model):
tournament = ndb.KeyProperty()
sponsor = ndb.KeyProperty()
sequence = ndb.IntegerProperty(default = 0)
active = ndb.BooleanProperty(default = False)
sort_name = ndb.StringProperty(default = '')
first_name = ndb.StringProperty(default = '')
last_name = ndb.StringProperty(default = '')
gender = ndb.StringProperty(default = '')
company = ndb.StringProperty(default = '')
address = ndb.StringProperty(default = '')
city = ndb.StringProperty(default = '')
state = ndb.StringProperty(default = '')
zip = ndb.StringProperty(default = '')
phone = ndb.StringProperty(default = '')
email = ndb.StringProperty(default = '')
average_score = ndb.StringProperty(default = '')
ghin_number = ndb.StringProperty(default = '')
has_index = ndb.BooleanProperty(default = False)
handicap_index = ndb.FloatProperty(default = 0.0)
shirt_size = ndb.StringProperty(default = '')
dinner_choice = ndb.StringProperty(default = '')
table_num = ndb.IntegerProperty(default = 0)
team = ndb.KeyProperty()
cart = ndb.IntegerProperty(default = 0)
tees = ndb.IntegerProperty(default = 0) # 1 = Red, 2 = White, 3 = Blue
index_info_modified = ndb.BooleanProperty(default = False)
substitute = ndb.KeyProperty()
def get_handicap_index(golfer):
if golfer.has_index:
return golfer.handicap_index
try:
return float(golfer.average_score) * 0.8253 - 61.15
except:
return None
class Substitute(ndb.Model):
first_name = ndb.StringProperty(default = '')
last_name = ndb.StringProperty(default = '')
gender = ndb.StringProperty(default = '')
company = ndb.StringProperty(default = '')
address = ndb.StringProperty(default = '')
city = ndb.StringProperty(default = '')
state = ndb.StringProperty(default = '')
zip = ndb.StringProperty(default = '')
phone = ndb.StringProperty(default = '')
email = ndb.StringProperty(default = '')
average_score = ndb.StringProperty(default = '')
ghin_number = ndb.StringProperty(default = '')
has_index = ndb.BooleanProperty(default = False)
handicap_index = ndb.FloatProperty(default = 0.0)
shirt_size = ndb.StringProperty(default = '')
tees = ndb.IntegerProperty(default = 0) # 1 = Red, 2 = White, 3 = Blue
index_info_modified = ndb.BooleanProperty(default = False)
class DinnerGuest(ndb.Model):
tournament = ndb.KeyProperty()
sponsor = ndb.KeyProperty()
sequence = ndb.IntegerProperty(default = 0)
active = ndb.BooleanProperty(default = False)
first_name = ndb.StringProperty(default = '')
last_name = ndb.StringProperty(default = '')
dinner_choice = ndb.StringProperty(default = '')
table_num = ndb.IntegerProperty(default = 0)
class TributeAd(ndb.Model):
first_name = ndb.StringProperty(default = '')
last_name = ndb.StringProperty(default = '')
address = ndb.StringProperty(default = '')
city = ndb.StringProperty(default = '')
state = ndb.StringProperty(default = '')
zip = ndb.StringProperty(default = '')
phone = ndb.StringProperty(default = '')
email = ndb.StringProperty(default = '')
ad_size = ndb.IntegerProperty(default = 0)
go_campaign = ndb.BooleanProperty(default = False)
printed_names = ndb.StringProperty(default = '')
payment_due = ndb.IntegerProperty(default = 0)
payment_made = ndb.IntegerProperty(default = 0)
payment_type = ndb.StringProperty(default = '')
transaction_code = ndb.StringProperty(default = '')
auth_code = ndb.StringProperty(default = '')
timestamp = ndb.DateTimeProperty(auto_now_add = True)