Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
roomlist
Commits
acfc3e5e
Commit
acfc3e5e
authored
Apr 09, 2015
by
Daniel W Bond
Browse files
Merge branch 'master' of
https://git.gmu.edu/srct/roomlist
parents
9c7d91b2
4df57e6b
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
roomlist/housing/initial_data.json
View file @
acfc3e5e
This diff is collapsed.
Click to expand it.
roomlist/housing/room-numbers.py
View file @
acfc3e5e
...
...
@@ -18,29 +18,43 @@ def get_floor_num(line):
roomNumbers
=
open
(
'room-numbers'
,
'r'
)
print
"[{"
print
(
"[{"
)
# for line in file
for
line
in
roomNumbers
:
pk
=
1
curFloor
=
0
curFloorInBuilding
=
1
print
"}, {
\n
"
print
"
\"
floor
\"
: "
+
+
",
\n
"
print
"
\"
number
\"
: "
+
+
",
\n
"
print
"
\"
slug
\"
:
\"
"
+
slug_generator
()
+
"
\"
,
\n
"
print
"
\"
room_num
\"
:
\"
"
+
+
"
\"
,
\n
"
print
" },"
print
"
\"
model
\"
:
\"
housing.room
\"
,
\n
"
print
"
\"
pk
\"
:
\n
"
print
"}]"
for
line
in
roomNumbers
:
line
=
line
.
rstrip
(
'
\n
'
)
if
re
.
match
(
'[a-zA-Z]'
,
line
):
curFloor
+=
1
curFloorInBuilding
=
1
else
:
if
int
(
float
(
get_floor_num
(
line
)))
>
curFloorInBuilding
:
curFloor
+=
1
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": {
"floor": 8,
"number": 204,
"slug": "8J6yWD",
"floor_num": "2"
"floor": 1,
"created": "2015-04-09T19:56:59.594Z",
"number": 101,
"modified": "2015-04-09T19:56:59.598Z",
"room_num": "101",
"slug": "G4xTdX"
},
"model":"housing.floor",
"pk":44
"model": "housing.room",
"pk": 1
}, {
"""
roomlist/housing/room-output.json
0 → 100644
View file @
acfc3e5e
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment