Skip to content
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

Merged
merged 29 commits into from
Dec 15, 2023

Conversation

Bruce-8
Copy link
Contributor

@Bruce-8 Bruce-8 commented Oct 20, 2023

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:

  • Modified graders_manager.jsx to allow for RawGroupsTable to display inactive groups when the icon Display inactive groups is clicked. Created a Display inactive groups icon on the right-hand pane of the web interface.
  • Updated the hidden tooltip for the Display inactive groups icon to include the amount of hidden groups.

Back-end:

  • Modified the index action of graders_controller.rb to include the members attribute of groups 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):

  • New feature (non-breaking change which adds functionality)

Testing

  • Manually tested changes through the web interface.

Questions and Comments (if applicable)

Checklist

  • I have performed a self-review of my own code.
  • I have verified that the pre-commit.ci checks have passed.
  • I have verified that the CI tests have passed.
  • I have reviewed the test coverage changes reported on Coveralls.
  • I have updated the Changelog.md file.

Pull request to make documentation changes (if applicable)

@Bruce-8 Bruce-8 marked this pull request as draft October 20, 2023 04:02
Bruce-8 and others added 7 commits October 20, 2023 00:06
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)
@Bruce-8 Bruce-8 changed the title Allow inactive grader groups to be displayed Allow inactive grader groups to be displayed and prevent inactive graders to join a group Oct 27, 2023
@Bruce-8 Bruce-8 changed the title Allow inactive grader groups to be displayed and prevent inactive graders to join a group Allow inactive groups in the graders tab to be displayed and prevent inactive graders from joining a group Oct 27, 2023
@Bruce-8 Bruce-8 marked this pull request as ready for review October 28, 2023 21:55
@Bruce-8 Bruce-8 changed the title Allow inactive groups in the graders tab to be displayed and prevent inactive graders from joining a group Allow inactive groups in the graders tab to be displayed Oct 28, 2023
@coveralls
Copy link
Collaborator

coveralls commented Oct 28, 2023

Pull Request Test Coverage Report for Build 7159783050

  • 52 of 53 (98.11%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.3%) to 91.563%

Changes Missing Coverage Covered Lines Changed/Added Lines %
app/assets/javascripts/Components/graders_manager.jsx 19 20 95.0%
Totals Coverage Status
Change from base Build 7104317343: -0.3%
Covered Lines: 38537
Relevant Lines: 41467

💛 - Coveralls

Copy link
Contributor

@david-yz-liu david-yz-liu left a 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)
Copy link
Contributor

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;
Copy link
Contributor

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) {
Copy link
Contributor

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'
Copy link
Contributor

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:

  1. You shouldn't add additional code in the controller method; instead, add code to the current_grader_data method instead.
  2. 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 using joins that combines the grouping and roles (as student members) tables together. After doing so you can then group the results by grouping_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.

mimischly7 and others added 4 commits November 10, 2023 22:58
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
@Bruce-8 Bruce-8 changed the title Allow inactive groups in the graders tab to be displayed Allow inactive groups in the graders table to be toggled for display Nov 21, 2023
Bruce-8 and others added 5 commits November 20, 2023 21:24
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)
Copy link
Contributor

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.

@@ -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 -----
Copy link
Contributor

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 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this file

let(:grouping) { create :grouping_with_inviter, inviter: student, assignment: assignment }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this line

@@ -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] = [] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary


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] = [] }
Copy link
Contributor

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)
Copy link
Contributor

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.

Bruce-8 and others added 2 commits December 8, 2023 05:48
I was initially defining some default behavior for some hashes in the Assignment model, but this was redundant.
@david-yz-liu david-yz-liu merged commit 51edbf2 into MarkUsProject:master Dec 15, 2023
6 checks passed
@david-yz-liu david-yz-liu added this to the v2.4.2 milestone Dec 18, 2023
@Bruce-8 Bruce-8 deleted the display-inactive-graders branch January 9, 2024 15:57
donny-wong pushed a commit to donny-wong/Markus that referenced this pull request Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants