-
Notifications
You must be signed in to change notification settings - Fork 242
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
Allow inactive groups in the graders table to be toggled for display #6778
Allow inactive groups in the graders table to be toggled for display #6778
Conversation
Implementing the following functionality: When an instructor tries to add an inactive grader to a group, the system prevents him from doing so and throws a red flash-message saying the user is inactive and thus cannot be added.
Our goal is to be able to determine in the ffront end which groups should be hidden because they are inactive. Our definition of an inactive group is that all of its members are inactive. Thus, (along with the graders associated to each group, which we already passing to the front end) we need to pass the (student) members associated with each group. This will allow the front end for this graders use case to act similarly to the front end of the groups use case (by filtering which groups should be visible or not based on the activity/inacticity of their users)
… display-inactive-graders Resolve merge conflicts
Pull Request Test Coverage Report for Build 7159783050
💛 - Coveralls |
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.
@Bruce-8 and @mimischly7 good work. I left some comments for you guys to work on; additionally, make sure to add test cases for both the front-end and back-end changes.
Changelog.md
Outdated
@@ -15,6 +15,7 @@ | |||
## [v2.3.3] | |||
- Fix bug where uploading scanned exam pages with overwriting option selected did not update submission files (#6768) | |||
- Fix bug: "Download Submissions" download link was not being rendered from partial view (#6779) | |||
- Allow inactive groups in the graders tab to be displayed (#6778) |
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.
This entry should go under the "unreleased" section above.
Also, please reword to "Allow inactive groups in the graders table to be toggled for display". (Since they were originally already displayed, this change makes it so that you can hide these groups.)
@@ -66,6 +68,15 @@ class GradersManager extends React.Component { | |||
if (this.groupsTable) this.groupsTable.resetSelection(); | |||
if (this.criteriaTable) this.criteriaTable.resetSelection(); | |||
|
|||
var inactive_groups_count = 0; |
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.
In general use let
instead of var
for variable declarations. (See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let)
}); | ||
let showHiddenGraderTooltip = ""; | ||
let showHiddenGroupsTooltip = ""; | ||
if (this.props.hiddenStudentsCount !== null && this.props.hiddenGroupsCount !== null) { |
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.
hiddenStudentsCount
is not correct (make sure you are testing this carefully)
@@ -15,10 +15,30 @@ class GradersController < ApplicationController | |||
def index | |||
@assignment = Assignment.find(params[:assignment_id]) | |||
|
|||
# We will complement the data hash returned by the Assignment.current_grader_data method by adding 'groups.members' |
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.
This code has the right idea, but I have a few comments for improving it:
- You shouldn't add additional code in the controller method; instead, add code to the
current_grader_data
method instead. - Right now the loop (
data[:groups].each
) has an N + 1 query problem (I recommend looking up what that means). Instead of doing this, a better approach is to make a single database query usingjoins
that combines thegrouping
androles
(as student members) tables together. After doing so you can then group the results bygrouping_id
and then merge with the existing grouping data.
As a tip, I strongly recommend using the Rails console to experiment with making more complex active record queries, since you'll likely need to iterate a bunch to get this right.
converting left outer join to inner join, setting default behavior for some hashes (for when trying to access a non-existent key), and adding documentation
A simple rspec test for the Assignment.current_grader_data method that ensures the returned object has the structure required by frontend code to operate correctly.
… display-inactive-graders Resolve merge conflicts
rspec test that checks the members contained in the object returned by Assignment.current_grader_data is correct.
Changelog.md
Outdated
@@ -15,6 +15,7 @@ | |||
- Ensure bonus marks are not included in assignment "out of" in submissions table (#6836) | |||
- Ensure assignment "out of" in submissions table is rounded to two decimal places (#6836) | |||
- Added POST API for Group Creation (#6834) | |||
- Allow inactive groups in the graders table to be toggled for display (#6778) |
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.
We've updated the changelog with a new minor release. Please do a merge from master; after that, make sure to move this entry so it appears under the "Unreleased" section.
app/models/assignment.rb
Outdated
@@ -1091,6 +1091,39 @@ def current_grader_data | |||
hide_unassigned_criteria: self.hide_unassigned_criteria, | |||
sections: assignment.course.sections.pluck(:id, :name).to_h | |||
} | |||
|
|||
# ---- NEW CODE TO ADD MEMBERS TO EACH GROUP IN THE CURRENT DATA SET ----- |
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.
Delete the comments in this section
@@ -0,0 +1,2 @@ | |||
{ |
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.
Delete this file
spec/models/assignment_spec.rb
Outdated
let(:grouping) { create :grouping_with_inviter, inviter: student, assignment: assignment } | ||
|
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.
delete this line
…/Markus into display-inactive-graders Fixing merge conflicts
app/models/assignment.rb
Outdated
@@ -1091,6 +1091,19 @@ def current_grader_data | |||
hide_unassigned_criteria: self.hide_unassigned_criteria, | |||
sections: assignment.course.sections.pluck(:id, :name).to_h | |||
} | |||
|
|||
result.default_proc = proc { |h, k| h[k] = [] } |
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.
This isn't necessary
app/models/assignment.rb
Outdated
|
||
grouped_data = members_data.group_by { |x| x[0] } | ||
grouped_data.each_value { |a| a.each { |b| b.delete_at(0) } } | ||
grouped_data.default_proc = proc { |h, k| h[k] = [] } |
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.
This isn't necessary
Changelog.md
Outdated
@@ -18,6 +18,7 @@ | |||
- Ensure starter files are passed to autotester in sorted order (#6771) | |||
- Resolved issue 6677 by taking timed assessment's duration into account when determining when grading can begin (#6845) | |||
- Fix loading results page when group is created after the due date (#6863) | |||
- Allow inactive groups in the graders table to be toggled for display (#6778) |
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.
There's been another release! Please do another pull from upstream master and put this entry under an [unreleased]
section.
I was initially defining some default behavior for some hashes in the Assignment model, but this was redundant.
…arkUsProject#6778) Co-authored-by: Mimis Chlympatsos <[email protected]> Co-authored-by: David Liu <[email protected]>
Motivation and Context
Currently on the assignment groups tab, it is possible to hide students and groups that are inactive. This pull request adds the same kind of filtering to the graders tab, to toggle whether to display inactive groups on the right-hand pane.
Your Changes
Description:
Front-end:
graders_manager.jsx
to allow forRawGroupsTable
to display inactive groups when the iconDisplay inactive groups
is clicked. Created aDisplay inactive groups
icon on the right-hand pane of the web interface.Display inactive groups
icon to include the amount of hidden groups.Back-end:
index
action ofgraders_controller.rb
to include themembers
attribute ofgroups
in the grader data so the front-end is able to determine whether a group is inactive or not based on its members (students).Type of change (select all that apply):
Testing
Questions and Comments (if applicable)
Checklist
Pull request to make documentation changes (if applicable)