Commit bd01aa11 authored by Rafael Ravedutti's avatar Rafael Ravedutti

Fix schedules index error 500 when schedules is null

Signed-off-by: Rafael Ravedutti's avatarRafael Ravedutti <rrlmachado@inf.ufpr.br>
parent 2958fe87
Pipeline #15519 failed with stage
in 2 minutes and 12 seconds
......@@ -30,14 +30,14 @@ module Api::V1
Professional.get_permission(current_user[1])))
if @schedules.empty?
render json: {
errors: ["No schedules found."]
}, status: 404
elsif @schedules.nil?
if @schedules.nil?
render json: {
errors: ["You don't have the permission to view schedules."]
}, status: 403
elsif @schedules.empty?
render json: {
errors: ["No schedules found."]
}, status: 404
else
response = Hash.new
response[:num_entries] = @schedules.total_count
......@@ -55,14 +55,14 @@ module Api::V1
Professional.get_permission(current_user[1])))
if @schedules.empty?
render json: {
errors: ["No schedules found."]
}, status: 404
elsif @schedules.nil?
if @schedules.nil?
render json: {
errors: ["You don't have the permission to view schedules."]
}, status: 403
elsif @schedules.empty?
render json: {
errors: ["No schedules found."]
}, status: 404
else
response = Hash.new
response[:num_entries] = @schedules.total_count
......@@ -79,14 +79,14 @@ module Api::V1
Professional.get_permission(current_user[1])))
if @schedules.empty?
render json: {
errors: ["No schedules found."]
}, status: 404
elsif @schedules.nil?
if @schedules.nil?
render json: {
errors: ["You don't have the permission to view schedules."]
}, status: 403
elsif @schedules.empty?
render json: {
errors: ["No schedules found."]
}, status: 404
else
response = Hash.new
response[:num_entries] = @schedules.total_count
......
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