From 04299339d43e0aa9816b9cfd0ec1b2d89df7a01a Mon Sep 17 00:00:00 2001 From: thvmulle Date: Thu, 24 Oct 2024 13:52:02 +0200 Subject: [PATCH] Added empty list fallback if variables are not declared --- app/views/courses/questions.json.jbuilder | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/courses/questions.json.jbuilder b/app/views/courses/questions.json.jbuilder index 56efbedf11..b9d59bc736 100644 --- a/app/views/courses/questions.json.jbuilder +++ b/app/views/courses/questions.json.jbuilder @@ -1,11 +1,11 @@ json.unanswered do - json.array! @unanswered, partial: 'annotations/annotation', as: :annotation + json.array! @unanswered || [], partial: 'annotations/annotation', as: :annotation end json.in_progress do - json.array! @in_progress, partial: 'annotations/annotation', as: :annotation + json.array! @in_progress || [], partial: 'annotations/annotation', as: :annotation end json.answered do - json.array! @answered, partial: 'annotations/annotation', as: :annotation + json.array! @answered || [], partial: 'annotations/annotation', as: :annotation end