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
schedules
Commits
95848ad0
Commit
95848ad0
authored
Mar 25, 2019
by
Zac Wood
Browse files
Lots of work
parent
ef6460e9
Pipeline
#4114
failed with stage
in 2 minutes and 35 seconds
Changes
24
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
schedules/db/data/sp18.json
0 → 100644
View file @
95848ad0
This diff is collapsed.
Click to expand it.
schedules/db/load_course_ratings.rb
View file @
95848ad0
require
'json'
ratings
=
JSON
.
parse
(
File
.
read
(
'db/data/sm18.json'
))
semester
=
Semester
.
find_by!
(
season:
'Summer'
,
year:
"2018"
)
[[
'f18'
,
'Fall'
,
'2018'
],
[
'sp18'
,
'Spring'
,
'2018'
],
[
'f17'
,
'Fall'
,
'2017'
],
[
'sp17'
,
'Spring'
,
'2017'
]].
each
do
|
arr
|
puts
arr
ratings
=
JSON
.
parse
(
File
.
read
(
"db/data/
#{
arr
[
0
]
}
.json"
))
semester
=
Semester
.
find_by!
(
season:
arr
[
1
],
year:
arr
[
2
])
ratings
.
each
do
|
section
,
qs
|
section
=
section
.
split
(
','
).
first
subj
=
section
.
match
(
/[A-Z]+/
)[
0
]
course
=
section
.
match
(
/[0-9]{3} /
)[
0
].
strip
sect_num
=
section
.
match
(
/ [A-Z0-9]+/
)[
0
].
strip
name
=
"
#{
subj
}
#{
course
}
#{
sect_num
}
"
s
=
CourseSection
.
find_by
(
name:
name
,
semester:
semester
)
next
if
s
.
nil?
s
.
rating_questions
=
qs
s
.
save!
ratings
.
each
do
|
section
,
qs
|
section
=
section
.
split
(
','
).
first
subj
=
section
.
match
(
/[A-Z]+/
)[
0
]
course
=
section
.
match
(
/[0-9]{3} /
)[
0
].
strip
sect_num
=
section
.
match
(
/ [A-Z0-9]+/
)[
0
].
strip
name
=
"
#{
subj
}
#{
course
}
#{
sect_num
}
"
s
=
CourseSection
.
find_by
(
name:
name
,
semester:
semester
)
next
if
s
.
nil?
s
.
rating_questions
=
qs
s
.
save!
end
end
schedules/db/seeds.rb
View file @
95848ad0
...
...
@@ -117,7 +117,7 @@ def main
[
parser
.
parse_semesters
[
3
]]
else
# expand to include however many semesters you want
parser
.
parse_semesters
[
0
..
1
]
parser
.
parse_semesters
[
0
..
7
]
end
puts
"
\t
Parsing subjects..."
...
...
schedules/test/controllers/course_sections_controller_test.rb
0 → 100644
View file @
95848ad0
require
'test_helper'
class
CourseSectionsControllerTest
<
ActionDispatch
::
IntegrationTest
test
"should get show"
do
s
=
CourseSection
.
first
get
course_section_url
(
s
)
assert_response
:success
end
end
Prev
1
2
Next
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