Hotfix: parse oid when only one given
The function `show_detail` for courses was expecting an array of lecturer oids. When it got only one and therefore not an array but an int, the line `@lecturers_oid.each` would fail to parse the variable because it is not an array.
This commit is contained in:
parent
ae217a60ea
commit
cbcc7c3d25
@ -29,12 +29,20 @@ class Crawlers::CoursesCrawlerController < Crawlers::TissCrawlerController
|
|||||||
@lecturers_oid = @course['lecturers']['oid']
|
@lecturers_oid = @course['lecturers']['oid']
|
||||||
@lecturers_names = []
|
@lecturers_names = []
|
||||||
|
|
||||||
|
puts @lecturers_oid
|
||||||
|
|
||||||
if @lecturers_oid != nil
|
if @lecturers_oid != nil
|
||||||
|
if @lecturers_oid.is_a?(Array)
|
||||||
|
# In case @lecturers_oid contains multiple items
|
||||||
@lecturers_oid.each do |item|
|
@lecturers_oid.each do |item|
|
||||||
# For each org id get the associated name
|
# For each org id get the associated name
|
||||||
puts TissCrawler.get_oid_name(item)
|
puts TissCrawler.get_oid_name(item)
|
||||||
@lecturers_names << (TissCrawler.get_oid_name(item))
|
@lecturers_names << (TissCrawler.get_oid_name(item))
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
# In case @lecturers_oid only contains one item
|
||||||
|
@lecturers_names << (TissCrawler.get_oid_name(@lecturers_oid))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Host is needed for image rendering
|
# Host is needed for image rendering
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user