Commit beeffcff authored by Zac Wood's avatar Zac Wood

clean

parent b31f4f94
......@@ -7,13 +7,6 @@
</div>
<%= link_to instructor.name, instructor_path(instructor) %>
</div>
&nbsp;&nbsp;&nbsp;
<div class="attr">
<div class="icon">
<i class="fa fa-bars"></i>
</div>
<%= "#{instructor.section_count}" %> sections
</div>
</div>
</div>
</div>
......@@ -3,6 +3,7 @@ require 'nokogiri'
sem = ARGV.first
# bamboozle website
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
......@@ -48,7 +49,7 @@ values.each do |v|
headers: headers)
document = Nokogiri::HTML(resp)
rows = document.css('tr')
qs = [9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39].map do |n|
qs = (9..39).filter(&:odd?).map do |n|
datas = rows[n].css('td')
{ q: datas[0].text.match(/[A-Z].*/)[0], resp: datas[1].text.strip, instr_mean: datas[2].text.strip, dept_mean: datas[3].text.strip }
end
......@@ -57,4 +58,4 @@ values.each do |v|
puts '------------------------------'
end
File.write("#{sem}.json", all.to_json)
File.write("db/data/#{sem}.json", all.to_json)
......@@ -105,6 +105,7 @@ def load_closures
# (21..25).each { |n| Closure.create! date: Date.new(2018, 11, n), semester: fall2018 }
# (10..19).each { |n| Closure.create! date: Date.new(2018, 12, n), semester: fall2018 }
spring2019 = Semester.find_by(season: 'Spring', year: '2019')
return if spring2019.nil?
(11..17).each { |day| Closure.find_or_create_by! date: Date.new(2019, 3, day), semester: spring2019 }
end
......@@ -114,7 +115,7 @@ def main
parser = PatriotWeb::Parser.new
semesters = if ARGV.first == "update"
[parser.parse_semesters[3]]
[parser.parse_semesters.first]
else
# expand to include however many semesters you want
parser.parse_semesters[0..7]
......@@ -122,9 +123,8 @@ def main
puts "\tParsing subjects..."
subjects = [].to_set
subjects.merge(parser.parse_subjects(semesters.first[:value]))
subjects.merge(parser.parse_subjects(semesters.second[:value])) if semesters.count > 1
subjects.merge(parser.parse_subjects(semesters.third[:value])) if semesters.count > 2
# merge all of the subjects
semesters.each { |s| subjects.merge(parser.parse_subjects(s[:value])) }
subjects = subjects.to_a
puts "\tParsing courses from catalog.gmu.edu..."
......
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