Only identify users as working alone without an active programming group
This commit is contained in:
@ -299,7 +299,7 @@ class ExercisesController < ApplicationController
|
|||||||
|
|
||||||
private :update_exercise_tips
|
private :update_exercise_tips
|
||||||
|
|
||||||
def implement # rubocop:disable Metrics/CyclomaticComplexity
|
def implement # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
||||||
if session[:pg_id] && current_contributor.exercise != @exercise
|
if session[:pg_id] && current_contributor.exercise != @exercise
|
||||||
# we are acting on behalf of a programming group
|
# we are acting on behalf of a programming group
|
||||||
if current_user.admin?
|
if current_user.admin?
|
||||||
@ -315,7 +315,7 @@ class ExercisesController < ApplicationController
|
|||||||
# we are just acting on behalf of a single user who has already worked on this exercise as part of a programming group **in the context of the current study group**
|
# we are just acting on behalf of a single user who has already worked on this exercise as part of a programming group **in the context of the current study group**
|
||||||
session[:pg_id] = pg.id
|
session[:pg_id] = pg.id
|
||||||
@current_contributor = pg
|
@current_contributor = pg
|
||||||
elsif PairProgramming23Study.participate?(current_user, @exercise) && current_user.submissions.where(study_group_id: current_user.current_study_group_id, exercise: @exercise).none?
|
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.create(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)
|
current_user.pair_programming_waiting_users&.find_by(exercise: @exercise)&.update(status: :worked_alone)
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user