Skip to content

Commit

Permalink
Fix course_id not present bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Oct 10, 2024
1 parent 248fe9d commit 9325e48
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/controllers/submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9325e48

Please sign in to comment.