-
Notifications
You must be signed in to change notification settings - Fork 1
/
addAClassroom.py
105 lines (92 loc) · 3.48 KB
/
addAClassroom.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
from app.models import *
def addEdTech(room):
"""
Creates a record in the DB for an EducationTech
param room: a row from the spreadsheet
return: an EducationTech object
"""
pass
# FIXME: Do no GET. Only Create. Each room needs its own instance of Ed tech, or changes to one ed tech affect multiple rooms.
(e, created) = EducationTech.get_or_create(
projector = int(room["projector"]),
smartboards = int(room["smartboards"]),
instructor_computers = int(room["instructor_computers"]),
podium = int(room["podium"]),
student_workspace = int(room["student_workspace"]),
chalkboards = int(room["chalkboards"]),
whiteboards = int(room["whiteboards"]),
dvd = room["dvd"],
blu_ray = room["blu_ray"],
audio = room["audio"],
extro = room["extro"],
doc_cam = room["doc_cam"],
vhs = room["vhs"],
mondopad = room["mondopad"],
tech_chart = room["tech_chart"]
)
e.save()
return e
def addBuilding(room):
"""
Creates a record in the DB for a Building
param room: a row from the spreadsheet
return: a Building object
"""
(b, created) = Building.get_or_create(
name = room["building_name"],
shortName = room["shortName"]
)
b.save()
return b
def addRoom(room):
"""
Creates a room record in the DB
param room: a row from the spreadsheet
return: None
"""
r = Rooms(
movableFurniture = room["moveableFurniture"],
building = addBuilding(room),
number = room["roomNumber"].strip(),
# TODO: room[roomNumber] needs to be split and used for building & number. Make a relationship to the Building table using the name.
maxCapacity = int(room["seatingCapacity"]),
roomType = room["roomType"].strip(),
visualAcc = room["visualAccessibility"].strip(),
audioAcc = room["hearingAccessibility"].strip(),
physicalAcc = room["physicalAccessibility"].strip(),
educationTech = addEdTech(room),
specializedEq = room["specialEq"].strip(),
specialFeatures = room["specialFeatures"].strip()
)
# print(r.number)
r.save()
room = {"moveableFurniture" : True,
"roomNumber": "301A",
"seatingCapacity": 16,
"roomType": "Lecture",
"visualAccessibility": "C",
"physicalAccessibility": "C",
"hearingAccessibility": "C",
"specialEq": "",
"specialFeatures": "",
"projector": 1,
"smartboards": 0,
"instructor_computers": 0,
"podium": 1,
"student_workspace": 0,
"chalkboards": 0,
"whiteboards": 2,
"dvd": True,
"blu_ray": False,
"audio": True,
"extro": False,
"doc_cam": False,
"vhs": False,
"mondopad": False,
"tech_chart": False,
"building_name" : "Stephenson",
"shortName": "STE"
}
print("FIXME's need fixed before using this file")
if input("Do you want to continue? 1=YES, 0=NO") == 1:
addRoom(room)