Commit cc42e1da authored by Zac Wood's avatar Zac Wood
Browse files

Added basic favicons.

Should still add more for mobile devices + PWA support
parent 4d7d8564
<div class="container-fluid">
<div class="container">
<!-- The main screen consists of a row with two columns: the search results, and the cart -->
<div class="row">
<div id="page" class="row">
<!-- Search result, List of Courses -->
<div class="col-lg-8 col-12 col-sm-10 mx-auto order-2 order-lg-0" id="search-list">
<div class="col-lg-12 col-12 col-sm-12 mx-auto order-2 order-lg-0" id="search-list">
<%= yield %>
</div>
<!-- List of sections in the cart -->
</div>
<footer class="footer">
Schedules was built by <a href="https://srct.gmu.edu">Mason SRCT</a> and is completely open source. <br/>
Want to contribute? View the code on the <a href="https://git.gmu.edu/srct/schedules">SRCT GitLab</a>.<br/>
</footer>
</div>
<template id="cart-data" data-cart="<%= @cart.to_json %>"></template>
......@@ -9,22 +9,32 @@
data-cid="<%= course.id if defined?(course) %>"
data-type="<%= section.section_type %>"
>
<p><b class="subj"><%= "#{section.name}" %></b>: <%= section.title %></p>
<p><b class="subj"><%= "#{section.name}" %></b>: <%= section.title %> <em><%= "(##{section.crn})"%></em></p>
<% if editable %>
<% if in_cart? section.crn %>
<span class="float-right text-center add-remove-btn"><i id="icon" class="fas fa-minus"></i><br/><span class="text">Remove</span></span>
<% else %>
<span class="float-right text-center add-remove-btn"><i id="icon" class="fas fa-plus"></i><br/><span class="text">Add</span></span>
<% end %>
<span class="float-right text-center add-remove-btn"><i id="icon" class="fas fa-ellipsis-h"></i><br/><span class="text">Add</span></span>
<% end %>
<i class="fas fa-chalkboard-teacher"></i>
<% if section.instructor.name == "TBA" %>
TBA
<% else %>
<%= link_to section.instructor.name, section.instructor %><% end %> <br/>
<%= link_to section.instructor.name, section.instructor %>
<% unless section.instructor.rating.nil? %>
<%= render partial: 'shared/stars', locals: { percent: (section.instructor.rating[0] / 5 * 100).to_i }%>
<% end %>
<% end %>
<br/>
<i class="fas fa-map-marker-alt"></i> <%= section.location %> <br/>
<i class="fas fa-clock"></i> <%= "#{section.days}, #{section.start_time}-#{section.end_time}" %> <br/>
<% unless section.rating_questions.empty? %>
<br/>
<b>Rating Info</b> (<%= link_to("See all ratings", course_section_url(section))%>)
<ul>
<li>Instructor rating: <%= section.teaching_rating %></li>
<li>Course rating: <%= section.course_rating %></li>
</ul>
<% end %>
</li>
<div class="star-rating">
<div class="back-stars">
<i class="fas fa-star" aria-hidden="true"></i>
<i class="fas fa-star" aria-hidden="true"></i>
<i class="fas fa-star" aria-hidden="true"></i>
<i class="fas fa-star" aria-hidden="true"></i>
<i class="fas fa-star" aria-hidden="true"></i>
<div class="front-stars" style="width: <%= percent %>%">
<i class="fa fa-star" aria-hidden="true"></i>
<i class="fa fa-star" aria-hidden="true"></i>
<i class="fa fa-star" aria-hidden="true"></i>
<i class="fa fa-star" aria-hidden="true"></i>
<i class="fa fa-star" aria-hidden="true"></i>
</div>
</div>
</div>
# Registers all routes for the app.
Rails.application.routes.draw do
get 'about', to: 'about#index', as: 'about'
get '/', to: 'home#index', as: 'home'
get 'search', to: 'search#index'
get 'search', to: 'search#index', as: 'search'
get 'sessions/update', as: 'update_session'
get 'sessions/cart'
get 'sessions/add_bulk'
resources :courses, only: [:show]
resources :course_sections, only: [:show]
resources :instructors, only: [:index, :show]
get 'schedule', to: 'schedules#show', as: 'schedule'
get 'schedule/events', to: 'schedules#events'
get 'schedule/view', to: 'schedules#view', as: 'view_schedule'
scope :api, module: 'api' do # Register /api routes
......
......@@ -14,6 +14,7 @@ default: &default
cache_manifest: false
extensions:
- .jsx
- .js
- .sass
- .scss
......
require 'httparty'
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',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://crserating.gmu.edu/ReportPaper/',
'Content-Type': 'application/x-www-form-urlencoded',
'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',
'Upgrade-Insecure-Requests': '1',
'Cache-Control': 'max-age=0'
}
resp = HTTParty.post('https://crserating.gmu.edu/ReportPaper/InstructorList.cfm',
body: "SearchType=instructor&semester=#{sem}&ctitle=&iname=&divsname=&deptname=&disc=&ckey=&orig=off&SearchTypeHid=instructor",
headers: headers).body
document = Nokogiri::HTML(resp)
values = document.css('select option').map { |e| e['value'] }
i = values.index('--Select an Instructor--')
values = values[i + 1..-1]
all = {}
c = values.count
counter = 1
values.each do |v|
puts "#{counter}/#{c} getting data for #{v}..."
counter += 1
resp = HTTParty.post('https://crserating.gmu.edu/ReportPaper/InstructorList.cfm',
body: "SearchType=instructor&semester=#{sem}&ctitle=&iname=#{v}&divsname=&deptname=&disc=&ckey=&orig=off&SearchTypeHid=instructor",
headers: headers)
document = Nokogiri::HTML(resp)
rows = document.css('tr')
i = rows.index { |r| r.css('td').first&.text == 'Course' }
next if i.nil?
rows[i + 1..-3].each do |s_tr|
tds = s_tr.css('td')
id = tds.first.css('font a').first['href'].match(/[0-9]+/)[0]
section, instr = tds.first&.text, tds[2]&.text
resp = HTTParty.post("https://crserating.gmu.edu/ReportPaper/MeansSummary16.cfm?rat_num=#{id}&caller=InstructorList",
body: "semester=#{sem}&formseq=62&orig=off&iname=#{instr}",
headers: headers)
document = Nokogiri::HTML(resp)
rows = document.css('tr')
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
all[section] = qs
end
puts '------------------------------'
end
File.write("db/data/#{sem}.json", all.to_json)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
require 'json'
[['sp18', 'Spring', '2018'], ['sm18', 'Summer', '2018'], ['f18', 'Fall', '2018'],
['sp17', 'Spring', '2017'], ['sm17', 'Summer', '2017'], ['f17', 'Fall', '2017'],
['sp16', 'Spring', '2016'], ['sm16', 'Summer', '2016'], ['f16', 'Fall', '2016']].each do |arr|
begin
ratings = JSON.parse(File.read("db/data/#{arr[0]}.json"))
rescue StandardError
next
end
semester = Semester.find_by(season: arr[1], year: arr[2])
next if semester.nil?
puts "#{ratings[1]} #{ratings[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!
end
end
class AddRatingsToCourseSection < ActiveRecord::Migration[5.1]
def change
add_column :course_sections, :rating_questions, :string
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20190210152552) do
ActiveRecord::Schema.define(version: 20190307042304) do
create_table "closures", force: :cascade do |t|
t.date "date"
......@@ -40,6 +40,7 @@ ActiveRecord::Schema.define(version: 20190210152552) do
t.datetime "updated_at", null: false
t.integer "instructor_id"
t.integer "semester_id"
t.string "rating_questions"
t.index ["course_id"], name: "index_course_sections_on_course_id"
t.index ["instructor_id"], name: "index_course_sections_on_instructor_id"
t.index ["semester_id"], name: "index_course_sections_on_semester_id"
......
......@@ -8,6 +8,7 @@ require 'httparty'
require 'nokogiri'
require 'json'
require 'set'
require 'yaml/store'
def parse_courses(subjects)
courses = []
......@@ -105,6 +106,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
......@@ -117,14 +119,13 @@ def main
[parser.parse_semesters.first]
else
# expand to include however many semesters you want
parser.parse_semesters[0..7]
parser.parse_semesters[1..7]
end
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..."
......
......@@ -4,11 +4,17 @@
"dependencies": {
"@babel/polyfill": "^7.0.0",
"@rails/webpacker": "3.5",
"babel-preset-react": "^6.24.1",
"file-saver": "^2.0.0",
"fullcalendar": "^3.9.0",
"html2canvas": "^1.0.0-alpha.12",
"jquery": "^3.3.1",
"moment": "^2.23.0",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-big-calendar": "^0.20.4",
"react-dom": "^16.8.6",
"react-sizes": "^2.0.0",
"url-polyfill": "^1.1.3"
},
"devDependencies": {
......
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