Skip to content

Commit

Permalink
Log submission id upon submitting
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Jun 14, 2024
1 parent e3c6aa7 commit 3279246
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/controllers/submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,13 @@ def create
para[:user_id] = current_user.id
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)
# 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)

submission = Submission.new(para)
can_submit = true
if submission.exercise.present?
Expand Down
2 changes: 1 addition & 1 deletion app/policies/submission_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def media?
end

def permitted_attributes
%i[code exercise_id course_id]
%i[code exercise_id course_id series_id]
end

private
Expand Down

0 comments on commit 3279246

Please sign in to comment.