Add events for pair programming study

This commit is contained in:
kiragrammel
2023-09-04 23:57:30 +02:00
committed by Sebastian Serth
parent d1d5b0df6f
commit 79422225a8
15 changed files with 224 additions and 15 deletions

View File

@ -1,10 +1,7 @@
# frozen_string_literal: true
class EventsController < ApplicationController
def authorize!
authorize(@event || @events)
end
private :authorize!
before_action :require_user!
def create
@event = Event.new(event_params)
@ -20,12 +17,21 @@ class EventsController < ApplicationController
end
end
private
def authorize!
authorize(@event || @events)
end
def event_params
# The file ID processed here is the context of the exercise (template),
# not in the context of the submission!
params[:event]
&.permit(:category, :data, :exercise_id, :file_id)
&.merge(user: current_user)
&.merge(user: current_user, programming_group:, study_group_id: current_user.current_study_group_id)
end
def programming_group
current_contributor if current_contributor.programming_group?
end
private :event_params
end