Commit 95848ad0 authored by Zac Wood's avatar Zac Wood
Browse files

Lots of work

parent ef6460e9
Pipeline #4114 failed with stage
in 2 minutes and 35 seconds
This diff is collapsed.
require 'json' require 'json'
ratings = JSON.parse(File.read('db/data/sm18.json')) [['f18', 'Fall', '2018'], ['sp18', 'Spring', '2018'],
semester = Semester.find_by!(season: 'Summer', year: "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| ratings.each do |section, qs|
section = section.split(',').first section = section.split(',').first
subj = section.match(/[A-Z]+/)[0] subj = section.match(/[A-Z]+/)[0]
course = section.match(/[0-9]{3} /)[0].strip course = section.match(/[0-9]{3} /)[0].strip
sect_num = section.match(/ [A-Z0-9]+/)[0].strip sect_num = section.match(/ [A-Z0-9]+/)[0].strip
name = "#{subj} #{course} #{sect_num}" name = "#{subj} #{course} #{sect_num}"
s = CourseSection.find_by(name: name, semester: semester) s = CourseSection.find_by(name: name, semester: semester)
next if s.nil? next if s.nil?
s.rating_questions = qs s.rating_questions = qs
s.save! s.save!
end
end end
...@@ -117,7 +117,7 @@ def main ...@@ -117,7 +117,7 @@ def main
[parser.parse_semesters[3]] [parser.parse_semesters[3]]
else else
# expand to include however many semesters you want # expand to include however many semesters you want
parser.parse_semesters[0..1] parser.parse_semesters[0..7]
end end
puts "\tParsing subjects..." puts "\tParsing subjects..."
......
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
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