Store whether learners were manually invited to a programming group

This commit is contained in:
Sebastian Serth
2023-09-21 18:53:39 +02:00
parent dd78c18b87
commit bd1090be31
2 changed files with 3 additions and 1 deletions

View File

@ -12,10 +12,11 @@ class PairProgrammingWaitingUser < ApplicationRecord
disconnected: 2,
worked_alone: 3,
created_pg: 4,
invited_to_pg: 5,
}, _prefix: true
validates :user_id, uniqueness: {scope: %i[exercise_id user_type]}
validates :programming_group_id, presence: true, if: -> { status_joined_pg? || status_created_pg? }
validates :programming_group_id, presence: true, if: -> { status_joined_pg? || status_created_pg? || status_invited_to_pg? }
after_save :capture_event