-
Notifications
You must be signed in to change notification settings - Fork 1
/
account_authority.py
112 lines (90 loc) · 3.5 KB
/
account_authority.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
from datetime import datetime
class User:
def __init__(self, entry_id, email, grade, hashed_password, auth_token, creation_date, staff, admin, sport_team):
self.entry_id = entry_id
self.first_name = email.split('@')[0].split('_')[0].capitalize()
self.last_name = email.split('@')[0].split('_')[1].capitalize()
self.email = email
self.hashed_password = hashed_password
self.grade = grade
self.year_name = {9: "Freshman", 10: "Sophomore", 11: "Junior", 12: "Senior"}.get(self.grade)
self.auth_token = auth_token
self.creation_date = datetime.fromtimestamp(creation_date)
self.sport_team = sport_team
# Special Roles
self.staff = bool(staff)
self.admin = bool(admin)
class Order:
def __init__(self, entry_id,
availability_entry_id,
is_complete,
email,
restaurant,
order_date,
phone_number,
restaurant_pickup_time,
price,
pickup_location,
pickup_name,
runner_entry_id,
receipt_id,
location,
pickup_time):
self.entry_id = entry_id
self.email = email
self.availability_entry_id = availability_entry_id
self.runner_entry_id = runner_entry_id
self.is_complete = is_complete
self.restaurant = restaurant
self.order_date = order_date
self.phone_number = phone_number
self.price = price
self.pickup_name = pickup_name
self.pickup_location = pickup_location
self.restaurant_pickup_time = restaurant_pickup_time
self.receipt_id=receipt_id
self.location = location
self.pickup_time=pickup_time
class RunnerAvailability:
def __init__(self, entry_id, runner_entry_id, order_entry_id, reserved, date, block, is_complete, location):
self.entry_id = entry_id
self.runner_entry_id = runner_entry_id
self.order_entry_id = order_entry_id
self.reserved = bool(reserved)
self.date_string = date
self.date = datetime.strptime(date, "%Y-%m-%d")
self.block = block
self.is_complete = int(is_complete)
self.location = location
class Menu:
def __init__(self, name, price, stock, units_sold, profit_from_unit, unit_type, img):
self.name = name
self.price = price
self.stock = stock
self.units_sold = units_sold
self.profit_from_unit = profit_from_unit
self.unit_type = unit_type
self.img = img
# Experimental
class Statistics:
def __init__(self,
current_user_count,
all_time_user_count,
staff_count,
deliveries_scheduled,
deliveries_successful,
availabilities_scheduled,
gross_fees_income,
gross_spent_by_users,
):
# Users
self.current_user_count = current_user_count
self.all_time_user_count = all_time_user_count
self.staff_count = staff_count
# Deliveries
self.deliveries_scheduled_count = deliveries_scheduled
self.deliveries_successful_count = deliveries_successful
self.availabilities_scheduled_count = availabilities_scheduled
# Finances
self.gross_fees_income = gross_fees_income
self.gross_spent_by_users = gross_spent_by_users