Shorten XML for parsed course
Instead of passing the complete XML response to the page, only the part where the interesting fields for a course are stored should be passed as a parameter. It also shortens the code in the html.erb file that is necessary to pull out the wanted fields.
This commit is contained in:
parent
ba6d9b24a4
commit
23613f0a14
@ -1,6 +1,6 @@
|
||||
<% if @course != nil %>
|
||||
<%-# TODO parse more fields and style them appropriately -%>
|
||||
<h2><%= @course['tuvienna']['course']['title']['en'] %></h2>
|
||||
<h5><%= @course['tuvienna']['course']['courseType'] %> <%= @course['tuvienna']['course']['semesterCode'] %></h5>
|
||||
<%= button_to 'Add to favorites', action: :add_to_fav, number: @course['tuvienna']['course']['courseNumber'], semester: @course['tuvienna']['course']['semesterCode'] %>
|
||||
<h2><%= @course['title']['en'] %></h2>
|
||||
<h5><%= @course['courseType'] %> <%= @course['semesterCode'] %></h5>
|
||||
<%= button_to 'Add to favorites', action: :add_to_fav, number: @course['courseNumber'], semester: @course['semesterCode'] %>
|
||||
<% end %>
|
||||
|
||||
@ -33,7 +33,7 @@ class TissCrawler
|
||||
puts(url)
|
||||
|
||||
response = HTTParty.get(url)
|
||||
response.parsed_response
|
||||
response.parsed_response['tuvienna']['course']
|
||||
end
|
||||
|
||||
def self.get_host
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user