Commit a9745b26 authored by Zac Wood's avatar Zac Wood

Removed ratings from instructor page.

parent c7f8b5e9
Pipeline #5400 passed with stage
in 14 seconds
......@@ -30,3 +30,4 @@ coverage
subjects
/config/master.key
db/data
<%= render partial: 'shared/navbar' %>
<div class="row">
<div class="col-12 col-lg">
<div class="col-12 col-lg">
<h1><%= @course.full_name %></h1>
<h4><%= @course.title %></h4>
<% unless @rating.nil? %>
......@@ -20,31 +20,31 @@
</p>
</div>
<p class="mt-3"><%= @course.description %>.</p>
</div>
<p class="mt-3"><%= @course.description %></p>
</div>
<div class="col-12 col-lg">
<form class="semester-select" data-controller="semester-select">
<select name="semester_id" class="form-control" data-action="semester-select#changeSemester" aria-label="Semester">
<% @semesters.each do |sem| %>
<option
id="<%= sem.id %>"
name="semester_id"
value="<%= sem.id %>"
<% if sem.id == params[:semester_id]&.to_i %> selected <% end %>
>
<%= sem.to_s %>
</option>
<% end %>
</select>
</form>
<% @sections.each do |type, sections| %>
<% if @sections.keys.length > 1 %>
<h5 class="section-type-label"><%= type %></h5>
<% end %>
<ul class="section-list">
<%= render partial: 'shared/section', collection: sections %>
</ul>
<% end %>
</div>
<div class="col-12 col-lg">
<form class="semester-select" data-controller="semester-select">
<select name="semester_id" class="form-control" data-action="semester-select#changeSemester" aria-label="Semester">
<% @semesters.each do |sem| %>
<option
id="<%= sem.id %>"
name="semester_id"
value="<%= sem.id %>"
<% if sem.id == params[:semester_id]&.to_i %> selected <% end %>
>
<%= sem.to_s %>
</option>
<% end %>
</select>
</form>
<% @sections.each do |type, sections| %>
<% if @sections.keys.length > 1 %>
<h5 class="section-type-label"><%= type %></h5>
<% end %>
<ul class="section-list">
<%= render partial: 'shared/section', collection: sections %>
</ul>
<% end %>
</div>
</div>
<%= render(partial: 'shared/navbar') %>
<div class="row">
<div class="col-lg-4 col-12 mb-4">
<h1><%= @instructor.name %></h1>
<div class="col-lg-4 col-12 mb-4">
<h1><%= @instructor.name %></h1>
<% unless @rating[:teaching].nil? %>
<%= render(partial: 'shared/stars', locals: { percent: @rating[:teaching][0]/5*100 }) %>
<%= @rating[:teaching][0] %> / <%= @rating[:teaching][1] %> responses
<% end %>
</div>
<div class="col-lg-8 col-12">
<form class="semester-select" data-controller="semester-select">
<select name="semester_id" class="form-control" data-action="semester-select#changeSemester" aria-label="Semester">
<% @semesters.each do |sem| %>
<option
id="<%= sem.id %>"
name="semester_id"
value="<%= sem.id %>"
<% if sem.id == params[:semester_id]&.to_i %> selected <% end %>
>
<%= sem.to_s %>
</option>
<% end %>
</select>
</form>
<% @sections.each do |type, sections| %>
<% if @sections.keys.length > 1 %>
<h5 class="section-type-label"><%= type %></h5>
<% end %>
<ul class="section-list">
<%= render partial: 'shared/section', collection: sections %>
</ul>
<% end %>
</div>
<% unless @rating[:teaching].nil? %>
<%= render(partial: 'shared/stars', locals: { percent: @rating[:teaching][0]/5*100 }) %>
<%= @rating[:teaching][0] %> / <%= @rating[:teaching][1] %> responses
<% end %>
</div>
<div class="col-lg-8 col-12">
<!-- Semester dropdown -->
<form class="semester-select" data-controller="semester-select">
<select name="semester_id" class="form-control" data-action="semester-select#changeSemester" aria-label="Semester">
<% @semesters.each do |sem| %>
<option
id="<%= sem.id %>"
name="semester_id"
value="<%= sem.id %>"
<% if sem.id == params[:semester_id]&.to_i %> selected <% end %>
>
<%= sem.to_s %>
</option>
<% end %>
</select>
</form>
<!-- Render groups of section types + sections -->
<% @sections.each do |type, sections| %>
<!-- Only render a header if there's more than one section type -->
<% if @sections.keys.length > 1 %>
<h5 class="section-type-label"><%= type %></h5>
<% end %>
<!-- Sections -->
<ul class="section-list">
<%= render partial: 'shared/section', collection: sections, locals: { on_professor_page: true } %>
</ul>
<% end %>
</div>
</div>
<li id="section-<%= section.id %>"
data-crn="<%= "#{section.crn}" %>"
class="list-group-item card section-item"
>
<p><strong class="subj"><%= "#{section.name}" %></strong>: <%= section.title %> <em><%= "(##{section.crn})"%></em></p>
<li id="section-<%= section.id %>" data-crn="<%= "#{section.crn}" %>" class="list-group-item card section-item">
<p><strong class="subj"><%= "#{section.name}" %></strong>: <%= section.title %> <em><%= "(##{section.crn})" %></em></p>
<div class="stats">
<i class="fas fa-chalkboard-teacher"></i>
<% if section.instructor.name == "TBA" %>
<i class="fas fa-chalkboard-teacher"></i>
<% if section.instructor.name == "TBA" %>
TBA
<% else %>
<%= 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 %>
<% else %>
<%= link_to section.instructor.name, section.instructor %>
<% unless section.instructor.rating.nil? || defined?(:on_professor_page) %>
<%= render partial: 'shared/stars', locals: { percent: (section.instructor.rating[0] / 5 * 100).to_i }%>
<% 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}" %>
<% 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}" %>
</div>
<% unless section.rating_questions.empty? %>
<div class="ratings">
<div class="ratings">
<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>
<li>Instructor rating: <%= section.teaching_rating %></li>
<li>Course rating: <%= section.course_rating %></li>
</ul>
</div>
</div>
<% end %>
<div class="add-remove-link">
<a data-controller="toggle-section"
data-toggle-section-crn="<%= "#{section.crn}" %>"
class="underline add-section"
data-action="click->toggle-section#toggle"
>
<i data-target="toggle-section.icon" class="fas fa-plus add-remove-icon"></i>
<span data-target="toggle-section.text">Add Section to Cart</span>
</a>
<a data-controller="toggle-section"
data-toggle-section-crn="<%= "#{section.crn}" %>"
class="underline add-section"
data-action="click->toggle-section#toggle"
>
<i data-target="toggle-section.icon" class="fas fa-plus add-remove-icon"></i>
<span data-target="toggle-section.text">Add Section to Cart</span>
</a>
</div>
</li>
......@@ -27,7 +27,6 @@ module PatriotWeb
def parse_subjects(semester_id)
response = @networker.fetch_subjects(semester_id)
document = Nokogiri::HTML(response)
File.write('db/test.html', document.to_s)
get_subject_codes_from_option_values(document)
end
......@@ -66,7 +65,6 @@ module PatriotWeb
# @param document [Nokogiri::HTML::Document]
# @return [Array] courses
def get_courses(document, subject)
File.write("BIOL.html", document.to_s) if subject == "BIOL"
table = document.css('html body div.pagebodydiv table.datadisplaytable')
rows = table.css('tr')
data_from rows
......@@ -97,7 +95,6 @@ module PatriotWeb
details = rows[i + 2].css('td table tr td')
if details.empty?
# puts "#{full_name.join(' ')} is fake news"
i += 1
next
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