-
Notifications
You must be signed in to change notification settings - Fork 194
E2610 #315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
E2610 #315
Changes from all commits
1d34e3c
6d2a59c
98015ae
e288b9a
47f7348
112ea57
7a948be
08cabb2
27ec482
ef5c3d8
d468b9a
0b81cf3
7c1a019
b262796
3a5fea0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,23 +35,18 @@ def team_size | |
| def max_size | ||
| if is_a?(AssignmentTeam) && assignment&.max_team_size | ||
| assignment.max_team_size | ||
| elsif is_a?(CourseTeam) && course&.max_team_size | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this check removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Restored the elsif is_a?(CourseTeam) check in max_size that was previously removed. Added a respond_to? guard since the Course model does not currently have a max_team_size column |
||
| elsif is_a?(CourseTeam) && course&.respond_to?(:max_team_size) && course&.max_team_size | ||
| course.max_team_size | ||
| else | ||
| nil | ||
| end | ||
| end | ||
|
|
||
| def full? | ||
| current_size = participants.count | ||
| max = max_size | ||
| return false if max.blank? | ||
|
|
||
| # assignment teams use the column max_team_size | ||
| if is_a?(AssignmentTeam) && assignment&.max_team_size | ||
| return current_size >= assignment.max_team_size | ||
| end | ||
|
|
||
| # course teams never fill up by default | ||
| false | ||
| participants.count >= max | ||
| end | ||
|
|
||
| # Checks if the given participant is already on any team for the associated assignment or course. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| class AddUniqueIndexOnParticipantIdToTeamsParticipants < ActiveRecord::Migration[8.0] | ||
| def change | ||
| # Uniqueness is enforced at model level via participant_on_team? in Team#add_member | ||
| # A DB-level unique index on participant_id alone would prevent participants from moving between teams | ||
| end | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please explain with a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comments