-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
72 lines (59 loc) · 2.01 KB
/
app.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
import os
import bed_data
import controller
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route('/')
@app.route('/dashboard')
def dashboard():
# Get trust statuses
list_of_trusts = ['R1A', 'R1A02','RA708']
trust_data = controller.get_trust_statuses(list_of_trusts)
# Get active requests
active_request_list = controller.get_active_requests()
no_of_requests = len(active_request_list)
active_request_data = {
'count': no_of_requests,
'requests': active_request_list
}
# Get accepted requests
accepted_request_list = controller.get_accepted_requests()
no_of_requests = len(accepted_request_list)
accepted_request_data = {
'count': no_of_requests,
'requests': accepted_request_list
}
# Get rejected requests
rejected_request_list = controller.get_rejected_requests()
no_of_requests = len(rejected_request_list)
rejected_request_data = {
'count': no_of_requests,
'requests': rejected_request_list
}
# Get cancelled requests
cancelled_request_list = controller.get_cancelled_requests()
no_of_requests = len(cancelled_request_list)
cancelled_request_data = {
'count': no_of_requests,
'requests': cancelled_request_list
}
return render_template('dashboard.html',
trusts=trust_data,
active_request_list=active_request_data,
rejected_request_list=rejected_request_data,
cancelled_request_list=cancelled_request_data,
accepted_request_list=accepted_request_data
)
@app.route('/units')
def units():
trust_data = controller.get_all_trust_statuses()
return render_template('units.html',
trusts=trust_data)
if __name__ == "__main__":
port = int(os.environ.get("PORT", 5000))
app.run(
host="0.0.0.0",
port = port,
debug=True
)