From 9325e483328ba80a2f935627bef71796379035e7 Mon Sep 17 00:00:00 2001 From: jorg-vr Date: Thu, 10 Oct 2024 15:03:35 +0200 Subject: [PATCH] Fix course_id not present bug --- app/controllers/submissions_controller.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index 25659617a9..809f266841 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -111,11 +111,15 @@ def create para[:code].gsub!(/\r\n?/, "\n") para[:evaluate] = true # immediately evaluate after create # check if user is member of course - course = Course.find(para[:course_id]) if para[:course_id].present? - para.delete(:course_id) if para[:course_id].present? && course.subscribed_members.exclude?(current_user) + if para[:course_id].present? + course = Course.find(para[:course_id]) + para.delete(:course_id) if course.subscribed_members.exclude?(current_user) + end # check if series is part of course - series = Series.find(para[:series_id]) if para[:series_id].present? && para[:course_id].present? - para.delete(:series_id) if para[:series_id].present? && course.series.exclude?(series) + if para[:series_id].present? && para[:course_id].present? + series = Series.find(para[:series_id]) + para.delete(:series_id) if course.series.exclude?(series) + end submission = Submission.new(para) can_submit = true