Prevent duplicated 'pp_work_alone' events.

* Ensure only one `pp_work_alone` event is stored.
* Disable Turbolinks for Programming Groups Work Alone, so that the implement page is requested normally. Otherwise, Turbolinks would load the page first, just to notice that it needs to reload the page afterwards to include Highlight.js for the tips.
This commit is contained in:
Sebastian Serth
2023-09-23 20:45:49 +02:00
parent 47dd4cf4f7
commit e5678483cc
3 changed files with 3 additions and 3 deletions

View File

@ -316,7 +316,7 @@ class ExercisesController < ApplicationController
session[:pg_id] = pg.id
@current_contributor = pg
elsif session[:pg_id].blank? && PairProgramming23Study.participate?(current_user, @exercise) && current_user.submissions.where(study_group_id: current_user.current_study_group_id, exercise: @exercise).none?
Event.create(category: 'pp_work_alone', user: current_user, exercise: @exercise, data: nil, file_id: nil)
Event.find_or_create_by(category: 'pp_work_alone', user: current_user, exercise: @exercise, data: nil, file_id: nil)
current_user.pair_programming_waiting_users&.find_by(exercise: @exercise)&.update(status: :worked_alone)
end