-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.py
More file actions
executable file
·52 lines (48 loc) · 1.62 KB
/
dashboard.py
File metadata and controls
executable file
·52 lines (48 loc) · 1.62 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
from everything import *
from API.faculty import getLDAPFaculty
from API.projects import getProject
from API.parameters import getCurrentParameters
from datetime import datetime
@app.route("/dashboard", methods = ["GET"])
@app.route("/", methods = ["GET"])
@login_required
def dashboard():
'''
This page generate the dashboard
'''
ldap = getLDAPFaculty(g.user.username)
project = getProject(g.user.username)
currentCycle = getCurrentParameters()
today = datetime.now()
dateState = findDateState(today)
email_address_IRBchair = "%[email protected]" % (str(currentCycle.IRBchair_id.username))
email_address_currentchair = "%[email protected]" % (str(currentCycle.currentchair_id.username))
email_address_staffsupport = "%[email protected]" % (str(currentCycle.staffsupport_id.username))
return render_template ("dashboard.html",
cfg=cfg,
ldap=ldap,
proj=project,
currentCycle=currentCycle,
today=today,
email_IRBchair=email_address_IRBchair,
email_currentchair=email_address_currentchair,
email_staffsupport=email_address_staffsupport,
dateState = dateState
)
def findDateState(today):
'''
Finds the current state of the applications based on date
DateTime today: the date to check
return: String representing the state of that date.
'''
currentParam = getCurrentParameters()
if today < currentParam.appOpenDate:
return "preapp"
elif today < currentParam.appCloseDate:
return "appopen"
elif today < currentParam.ProposalAcceptanceDate:
return "reviewopen"
elif today < currentParam.AllSubmissionsClosedDate:
return "absopen"
else:
return "allclosed"