-
Notifications
You must be signed in to change notification settings - Fork 1
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
Default assignments on classroom join #73
Conversation
For "custom" (Wildcam-style, custom assignment) programs, teachers create assignments before or after a classroom is joined and then assign them to students. However, for non-custom (i2a) programs, the order of operations will look more like this: 1) Teacher creates classroom 2) Default assignments are automatically generated by the i2a frontend. 3) Stutent attempts to join classroom and is automatically assigned each of the classroom's assignments. This PR adds that check, based on the program's `custom` attribute, and assigns them if it is false.
it "adds the user to all assignments" do | ||
outcome = described_class.run!(current_user: current_user, client: client, | ||
id: classroom.id, join_token: classroom.join_token) | ||
expect(standard_assignment.student_users.map {|su| su.user_id }).to include(current_user.id) |
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.
Pass &:user_id as an argument to map instead of a block.
let!(:custom_assignment) { create(:assignment, classroom: custom_classroom) } | ||
|
||
it "doesn't affect assignments" do | ||
expect{ |
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.
Parenthesize the param change{ custom_assignment.student_users } to make sure that the block will be associated with the change method call.
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.
seems like a known rubocop bug (rubocop/rubocop#4198), updating might fix.
app/operations/classrooms/join.rb
Outdated
response = join_panoptes_group(classroom) | ||
|
||
if response | ||
classroom.students << current_user | ||
add_user_to_assignments if !classroom.program.custom? |
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.
Favor unless over if for negative conditions.
I incorporated a couple older, unmerged PRs related to classroom requests requiring programs. Should be ready for review now, though, @marten. |
Just so you all know the timeline for this, we're tentatively planning on deploying the education api to production the first week of December while @zwolf and I are in Oxford. I'm out the third week of Nov (in about a week and a half) and I'm depending on this feature to finish the remaining I2A front end features. Getting this reviewed sooner than later would be very helpful. Thanks. |
@marten mind taking a quick look at this? |
For "custom" (Wildcam-style, custom assignment) programs, teachers create assignments before or after a classroom is joined and then assign them to students. However, for non-custom (i2a) programs, the order of operations will look more like this:
This PR adds that check, based on the program's
custom
attribute, and assigns them if it is false. Programs are now required by all classroom requests and are an included association in the classroom factory.