Commit ed3d3716 authored by Zac Wood's avatar Zac Wood

Added prereq column to Course and loads them from catalog

parent 5f25e64f
......@@ -11,8 +11,15 @@
<p class="description"><%= course.description %></p>
<% unless course.prereqs.empty? %>
<% first, rest = course.prereqs.split(':') %>
<% prereqs, note = rest.split('.') %>
<p><strong><%= first %>:</strong> <%= prereqs %> <sub><%= note %></sub></p>
<% end %>
<div class="d-block" style="text-align: center">
<i class="fas fa-chevron-down"></i>
<p style="margin-bottom:-4px; font-size: 10px;">Expand</p>
<i class="fas fa-chevron-down"></i>
</div>
<!-- List of Course Sections -->
......
......@@ -22,12 +22,15 @@ def get_courses(subj)
description = course.css('.courseblockdesc').text
prereqs = course.css('p.prereq').text
{
subject: subj,
title: name,
course_number: num,
credits: credits_num,
description: description
description: description,
prereqs: prereqs
}
end
end
class AddPrereqsToCourses < ActiveRecord::Migration[5.1]
def change
add_column :courses, :prereqs, :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: 20180914210918) do
ActiveRecord::Schema.define(version: 20180927133105) do
create_table "closures", force: :cascade do |t|
t.date "date"
......@@ -54,6 +54,7 @@ ActiveRecord::Schema.define(version: 20180914210918) do
t.string "prerequisite"
t.string "restrictions"
t.string "title"
t.string "prereqs"
t.index ["semester_id"], name: "index_courses_on_semester_id"
end
......
......@@ -30,6 +30,7 @@ def load_courses(courses, semester)
course_number: course[:course_number],
credits: course[:credits],
description: course[:description],
prereqs: course[:prereqs],
semester: semester
}
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