Commit 160d7746 authored by Zac Wood's avatar Zac Wood

Fixed pass courses list on instructor page

parent 38686284
Pipeline #3489 passed with stages
in 41 minutes and 27 seconds
......@@ -16,6 +16,12 @@ class InstructorsController < ApplicationController
sections.each do |s|
@courses.add s.course
end
@past = []
@instructor.course_sections.map(&:course).each do |c|
@past << c unless @past.select { |past| past.full_name == c.full_name }.count.positive?
end
@past.sort_by!(&:full_name)
end
private
......
<div class="row">
<div class="col-lg-4 col-12">
<h1><%= @instructor.name %></h1>
<% prev = @instructor.course_sections.map(&:course).uniq.reject { |c| c.semester == @semester } %>
<% if prev.count.positive? %>
<% if @past.count.positive? %>
<strong>Previously taught: </strong>
<ul>
<% prev.each do |s| %>
<li><%= link_to s.full_name, course_path(s) %></li>
<% @past.each do |c| %>
<li><%= link_to c.full_name, course_path(c) %></li>
<% end %>
</ul>
<% 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