Commit 91c9d5a7 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

added Piedmont and Tidewater support @akarthik

parent 0729d113
......@@ -124,3 +124,14 @@ Sandbridge
4
5
6
Piedmont
2
3
4
5
6
Tidewater
2
3
4
5
......@@ -797,7 +797,6 @@ Grayson
Potomac Heights
102
103
103
104
105
106
......@@ -822,7 +821,6 @@ Potomac Heights
154
155
202
203
203
204
205
......@@ -851,7 +849,6 @@ Potomac Heights
255
302
303
303
304
305
306
......@@ -880,7 +877,6 @@ Potomac Heights
354
355
402
403
403
404
405
......@@ -910,7 +906,6 @@ Potomac Heights
454
455
502
503
503
504
505
......@@ -952,7 +947,6 @@ Rogers
2019
2018
2007
2016
2102
2103
2016
......@@ -1062,7 +1056,6 @@ Whitetop
4032
4037
4038
4042
4027
4026
4044
......@@ -1082,7 +1075,6 @@ Whitetop
5021
5022
5034
4032
5037
5038
5042
......@@ -1591,3 +1583,115 @@ Sandbridge
623
624
626
Piedmont
203
202
228
227
226
225
223
221
218
217
216
215
207
205
303
302
328
327
326
325
323
321
318
317
316
315
307
305
403
402
428
427
426
425
423
421
418
417
416
415
407
405
503
502
528
527
526
525
523
521
518
517
516
515
507
505
603
602
628
627
626
625
623
621
618
617
616
615
607
605
Tidewater
205
207
216
217
220
223
224
225
202
203
305
307
316
317
320
323
324
325
302
303
405
407
416
417
420
423
424
425
402
403
505
507
516
517
520
523
524
525
502
503
......@@ -38,10 +38,12 @@ mason_housing = { 'Adams': 'sh',
'Madison': 'sh',
'Monroe': 'sh',
'Northern Neck': 'ra',
'Piedmont': 'ra',
'Potomac Heights': 'sh',
'Rogers': 'aq',
'Roosevelt': 'sh',
'Sandbridge': 'ra',
'Tidewater': 'ra',
'Truman': 'sh',
'Washington': 'sh',
'Whitetop': 'aq',
......@@ -49,8 +51,6 @@ mason_housing = { 'Adams': 'sh',
# Student Apartments -- multiple buildings
# Townhouses -- multiple buildings
# Piedmont -- broken off-by-one blueprint
# Tidewater -- broken off-by-one blueprint
# Beacon Hall -- graduate students
# Liberty Square -- Weird letters in name
# Mason Global Center -- international students
......@@ -58,30 +58,45 @@ mason_housing = { 'Adams': 'sh',
start_time = datetime.now()
print("Creating buildings...")
new_buildings = 0
for building_name, neighborhood in mason_housing.iteritems():
my_building = Building.objects.create(name=building_name, neighbourhood=neighborhood)
print(my_building)
my_building.save()
my_building, building_created = Building.objects.get_or_create(name=building_name,
neighbourhood=neighborhood)
if not building_created:
print(my_building)
else:
my_building.save()
new_buildings += 1
print(my_building, "(NEW!)")
print("Created %d buildings." % Building.objects.all().count())
print("Created %d new buildings, %d buildings total." % (new_buildings,
Building.objects.all().count()))
print("Creating floors...")
new_floors = 0
with open('housing/buildingFloors.txt') as buildings:
for line in buildings:
line = line.rstrip('\n')
line = line.strip()
if re.match('[a-z A-z]', line):
print(line)
current_building = Building.objects.get(name=line)
print(current_building)
else:
my_floor = Floor.objects.create(number=int(line), building=current_building)
my_floor.save()
my_floor, floor_created = Floor.objects.get_or_create(number=int(line),
building=current_building)
if floor_created:
my_floor.save()
new_floors += 1
print("Created %d floors." % Floor.objects.all().count())
print("Created %d new floors, %d floors total." % (new_floors, Floor.objects.all().count()))
print("Creating rooms...")
new_rooms = 0
with open('housing/building_rooms.txt') as rooms:
for line in rooms:
line = line.rstrip('\n')
line = line.strip()
if re.match('[a-z A-Z]', line):
current_building = Building.objects.get(name=line)
print(current_building)
......@@ -90,10 +105,12 @@ with open('housing/building_rooms.txt') as rooms:
my_floor = Floor.objects.get(building=current_building, number=int(line[1]))
else:
my_floor = Floor.objects.get(building=current_building, number=int(line[0]))
my_room = Room.objects.create(floor=my_floor, number=int(line))
my_room.save()
my_room, room_created = Room.objects.get_or_create(floor=my_floor, number=int(line))
if room_created:
new_rooms += 1
my_room.save()
print("Created %d rooms." % Room.objects.all().count())
print("Created %d new rooms, %d rooms total." % (new_rooms, Room.objects.all().count()))
end_time = datetime.now()
total_time = end_time - start_time
print("Elapsed time:", total_time)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment