Commit acfc3e5e authored by Daniel W Bond's avatar Daniel W Bond
Browse files

Merge branch 'master' of https://git.gmu.edu/srct/roomlist

parents 9c7d91b2 4df57e6b
This diff is collapsed.
...@@ -18,29 +18,43 @@ def get_floor_num(line): ...@@ -18,29 +18,43 @@ def get_floor_num(line):
roomNumbers = open('room-numbers', 'r') roomNumbers = open('room-numbers', 'r')
print "[{" print("[{")
# for line in file # for line in file
for line in roomNumbers: pk = 1
curFloor = 0
curFloorInBuilding = 1
print "}, {\n" for line in roomNumbers:
print " \"floor\": " + + ",\n" line = line.rstrip('\n')
print " \"number\": " + + ",\n" if re.match('[a-zA-Z]',line):
print " \"slug\": \"" + slug_generator() + "\",\n" curFloor += 1
print " \"room_num\": \"" + + "\",\n" curFloorInBuilding = 1
print " }," else:
print " \"model\":\"housing.room\",\n" if int(float(get_floor_num(line))) > curFloorInBuilding:
print " \"pk\":\n" curFloor += 1
print "}]" curFloorInBuilding += 1
print("}, {\"fields\": {")
print(" \"floor\": " + str(curFloor) + ",")
print(" \"number\": " + str(line) + ",")
print(" \"room_num\": \"" + str(line) + "\",")
print(" \"slug\": \"" + slug_generator() + "\"")
print(" },")
print(" \"model\":\"housing.room\",")
print(" \"pk\":" + str(pk))
pk = pk + 1
print("}]")
""" """
}, {
"fields": { "fields": {
"floor": 8, "floor": 1,
"number": 204, "created": "2015-04-09T19:56:59.594Z",
"slug": "8J6yWD", "number": 101,
"floor_num": "2" "modified": "2015-04-09T19:56:59.598Z",
"room_num": "101",
"slug": "G4xTdX"
}, },
"model":"housing.floor", "model": "housing.room",
"pk":44 "pk": 1
}, {
""" """
This diff is collapsed.
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