Commit 38c67ac5 authored by Zac Wood's avatar Zac Wood
Browse files

Spring 2019 ratings

parent f123e313
Pipeline #4452 passed with stage
in 3 minutes and 34 seconds
...@@ -2,7 +2,13 @@ import React from 'react'; ...@@ -2,7 +2,13 @@ import React from 'react';
const ShareModal = props => { const ShareModal = props => {
return ( return (
<div className="modal fade" id="shareModal" tabindex="-1" role="dialog" aria-labelledby="shareModalLabel" aria-hidden="true"> <div
className="modal fade"
id="shareModal"
tabindex="-1"
role="dialog"
aria-labelledby="shareModalLabel"
aria-hidden="true">
<div className="modal-dialog" role="document"> <div className="modal-dialog" role="document">
<div className="modal-content"> <div className="modal-content">
<div className="modal-header"> <div className="modal-header">
......
...@@ -8,7 +8,7 @@ headers = { ...@@ -8,7 +8,7 @@ headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0', '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', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate, br', 'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://crserating.gmu.edu/ReportPaper/', # 'Referer': 'https://crserating.gmu.edu/ReportPaper/',
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
'Connection': 'keep-alive', 'Connection': 'keep-alive',
'Cookie': 'ga=GA1.2.1878572417.1543773996; __unam=74bec77-167701a5090-6fe3a784-10; __insp_slim=1549744302281; CFID=1938650; CFTOKEN=b1990d0cd24bb3f4-19FA09EB-5056-9470-35EEF241BAFA23D5; CFGLOBALS=urltoken%3DCFID%23%3D1938650%26CFTOKEN%23%3Db1990d0cd24bb3f4%2D19FA09EB%2D5056%2D9470%2D35EEF241BAFA23D5%23lastvisit%3D%7Bts%20%272019%2D01%2D29%2019%3A40%3A10%27%7D%23timecreated%3D%7Bts%20%272019%2D01%2D29%2019%3A39%3A51%27%7D%23hitcount%3D7%23cftoken%3Db1990d0cd24bb3f4%2D19FA09EB%2D5056%2D9470%2D35EEF241BAFA23D5%23cfid%3D1938650%23; __insp_wid=1435896333; __insp_nv=true; __insp_ref=aHR0cHM6Ly9pcnIyLmdtdS5lZHUvTmV3L05fRW5yb2xsT2ZmL0VucmxTdHMuY2Zt; __insp_targlpu=https%3A%2F%2Firr2.gmu.edu%2FNew%2FN_EnrollOff%2FEnrlSts.cfm; __insp_targlpt=Office%20of%20Institutional%20Research%20and%20Effectiveness; BIGipServer~web.gmu.edu~goose.gmu.edu_p80=1242087434.20480.0000', 'Cookie': 'ga=GA1.2.1878572417.1543773996; __unam=74bec77-167701a5090-6fe3a784-10; __insp_slim=1549744302281; CFID=1938650; CFTOKEN=b1990d0cd24bb3f4-19FA09EB-5056-9470-35EEF241BAFA23D5; CFGLOBALS=urltoken%3DCFID%23%3D1938650%26CFTOKEN%23%3Db1990d0cd24bb3f4%2D19FA09EB%2D5056%2D9470%2D35EEF241BAFA23D5%23lastvisit%3D%7Bts%20%272019%2D01%2D29%2019%3A40%3A10%27%7D%23timecreated%3D%7Bts%20%272019%2D01%2D29%2019%3A39%3A51%27%7D%23hitcount%3D7%23cftoken%3Db1990d0cd24bb3f4%2D19FA09EB%2D5056%2D9470%2D35EEF241BAFA23D5%23cfid%3D1938650%23; __insp_wid=1435896333; __insp_nv=true; __insp_ref=aHR0cHM6Ly9pcnIyLmdtdS5lZHUvTmV3L05fRW5yb2xsT2ZmL0VucmxTdHMuY2Zt; __insp_targlpu=https%3A%2F%2Firr2.gmu.edu%2FNew%2FN_EnrollOff%2FEnrlSts.cfm; __insp_targlpt=Office%20of%20Institutional%20Research%20and%20Effectiveness; BIGipServer~web.gmu.edu~goose.gmu.edu_p80=1242087434.20480.0000',
...@@ -21,6 +21,7 @@ resp = HTTParty.post('https://crserating.gmu.edu/ReportPaper/InstructorList.cfm' ...@@ -21,6 +21,7 @@ resp = HTTParty.post('https://crserating.gmu.edu/ReportPaper/InstructorList.cfm'
headers: headers).body headers: headers).body
document = Nokogiri::HTML(resp) document = Nokogiri::HTML(resp)
values = document.css('select option').map { |e| e['value'] } values = document.css('select option').map { |e| e['value'] }
i = values.index('--Select an Instructor--') i = values.index('--Select an Instructor--')
values = values[i + 1..-1] values = values[i + 1..-1]
...@@ -35,6 +36,7 @@ values.each do |v| ...@@ -35,6 +36,7 @@ values.each do |v|
headers: headers) headers: headers)
document = Nokogiri::HTML(resp) document = Nokogiri::HTML(resp)
rows = document.css('tr') rows = document.css('tr')
i = rows.index { |r| r.css('td').first&.text == 'Course' } i = rows.index { |r| r.css('td').first&.text == 'Course' }
next if i.nil? next if i.nil?
...@@ -48,8 +50,9 @@ values.each do |v| ...@@ -48,8 +50,9 @@ values.each do |v|
body: "semester=#{sem}&formseq=62&orig=off&iname=#{instr}", body: "semester=#{sem}&formseq=62&orig=off&iname=#{instr}",
headers: headers) headers: headers)
document = Nokogiri::HTML(resp) document = Nokogiri::HTML(resp)
rows = document.css('tr') rows = document.css('tr')
qs = (9..39).filter(&:odd?).map do |n| qs = (9..39).to_a.select(&:odd?).map do |n|
datas = rows[n].css('td') 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 } { 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 end
......
...@@ -8,7 +8,19 @@ ...@@ -8,7 +8,19 @@
- "2019-3-17" - "2019-3-17"
"Fall 2019": "Fall 2019":
- "2019-09-02"
- "2019-10-14" - "2019-10-14"
- "2019-11-27" - "2019-11-27"
- "2019-11-28" - "2019-11-28"
- "2019-11-29" - "2019-11-29"
- "2019-12-08"
- "2019-12-09"
- "2019-12-10"
- "2019-12-11"
- "2019-12-12"
- "2019-12-13"
- "2019-12-14"
- "2019-12-15"
- "2019-12-16"
- "2019-12-17"
- "2019-12-18"
This diff is collapsed.
require 'json' require 'json'
[['sp18', 'Spring', '2018'], ['sm18', 'Summer', '2018'], ['f18', 'Fall', '2018'], [['sp19', 'Spring', '2019'], ['sp18', 'Spring', '2018'], ['sm18', 'Summer', '2018'], ['f18', 'Fall', '2018'],
['sp17', 'Spring', '2017'], ['sm17', 'Summer', '2017'], ['f17', 'Fall', '2017'], ['sp17', 'Spring', '2017'], ['sm17', 'Summer', '2017'], ['f17', 'Fall', '2017'],
['sp16', 'Spring', '2016'], ['sm16', 'Summer', '2016'], ['f16', 'Fall', '2016']].each do |arr| ['sp16', 'Spring', '2016'], ['sm16', 'Summer', '2016'], ['f16', 'Fall', '2016']].each do |arr|
begin begin
...@@ -11,7 +11,7 @@ require 'json' ...@@ -11,7 +11,7 @@ require 'json'
semester = Semester.find_by(season: arr[1], year: arr[2]) semester = Semester.find_by(season: arr[1], year: arr[2])
next if semester.nil? next if semester.nil?
puts "#{ratings[1]} #{ratings[2]}" puts "Loading #{arr[1]} #{arr[2]} course ratings..."
ratings.each do |section, qs| ratings.each do |section, qs|
section = section.split(',').first section = section.split(',').first
......
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