Skip to content

Commit

Permalink
Merge pull request #5855 from dodona-edu/fix/series-without-coure-id-…
Browse files Browse the repository at this point in the history
…submissions

Fix course_id not present bug
  • Loading branch information
jorg-vr authored Oct 10, 2024
2 parents 248fe9d + 9325e48 commit f5a31b9
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 f5a31b9

Please sign in to comment.