-
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
Merged
david-yz-liu
merged 29 commits into
MarkUsProject:master
from
Bruce-8:display-inactive-graders
Dec 15, 2023
Merged
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
fa0d6bc
Allow inactive grader groups to be displayed
Bruce-8 6359ef0
Updated Changelog and moved checkbox to righthand pane
Bruce-8 08e6e93
flash-message-for-inactive-grader
mimischly7 5f8f4ed
updating-Changelog
mimischly7 a1db588
enriching-data-returned-by-graders-controller-index-action
mimischly7 1bb7085
Changed front-end logic with filtering groups
Bruce-8 4d02bf7
Changed location of group string
Bruce-8 59c1898
Changed location of group string
Bruce-8 3a70425
Modified Changelog
Bruce-8 05630bb
Revert changes for flash message
Bruce-8 82b578c
Merge branch 'master' of https:/MarkUsProject/Markus into…
Bruce-8 b6226ed
Re-added deleted space in graders_manager
Bruce-8 a1e9313
working-code-for-getting-members-efficiently
mimischly7 f6e81b7
finalizing-backend-improvements
mimischly7 0ae0368
rspec-test-for-Assignment-method
mimischly7 d7b4fbd
Merge branch 'master' of https:/MarkUsProject/Markus into…
Bruce-8 f23392a
Fixed errors and changelog
Bruce-8 5720893
Added front-end tests
Bruce-8 289f81d
Increased coverage of new lines of code
Bruce-8 09561aa
Final test fixes (front-end)
Bruce-8 ab7f5dc
rspec-test-for-assign-all-graders
mimischly7 196be58
Fixed Changelog and merge conflicts
Bruce-8 87681b2
Merge branch 'display-inactive-graders' of https:/Bruce-8…
Bruce-8 7723b9b
final-touches
mimischly7 ca70459
conflict-resolution
mimischly7 29719a9
Modified Changelog
Bruce-8 e2c9a24
removing-unnecessary-lines
mimischly7 61e5dee
Merge branch 'master' into display-inactive-graders
david-yz-liu d659e07
Pin CI chromedriver version
david-yz-liu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
app/assets/javascripts/Components/__tests__/graders_manager.test.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/*** | ||
* Tests for GradersManager Component | ||
*/ | ||
|
||
import {GradersManager} from "../graders_manager"; | ||
import {render, screen, fireEvent} from "@testing-library/react"; | ||
|
||
jest.mock("@fortawesome/react-fontawesome", () => ({ | ||
FontAwesomeIcon: () => { | ||
return null; | ||
}, | ||
})); | ||
|
||
describe("For the GradersManager's display of inactive groups", () => { | ||
let groups_sample; | ||
beforeEach(() => { | ||
groups_sample = [ | ||
{ | ||
_id: 15, | ||
members: [ | ||
["c9nielse", "inviter", true], | ||
["c8szyman", "accepted", true], | ||
], | ||
inactive: false, | ||
grace_credits: 5, | ||
remaining_grace_credits: 4, | ||
group_name: "group_0015", | ||
graders: [], | ||
criteria_coverage_count: 0, | ||
}, | ||
{ | ||
_id: 15, | ||
members: [ | ||
["d2lifese", "inviter", false], | ||
["a3kjcbod", "accepted", false], | ||
], | ||
inactive: false, | ||
grace_credits: 5, | ||
remaining_grace_credits: 4, | ||
group_name: "group_0014", | ||
graders: [], | ||
criteria_coverage_count: 0, | ||
}, | ||
]; | ||
fetch.mockReset(); | ||
fetch.mockResolvedValueOnce({ | ||
ok: true, | ||
json: jest.fn().mockResolvedValueOnce({ | ||
graders: [], | ||
criteria: [], | ||
assign_graders_to_criteria: false, | ||
loading: false, | ||
sections: {}, | ||
anonymize_groups: false, | ||
hide_unassigned_criteria: false, | ||
isGraderDistributionModalOpen: false, | ||
groups: groups_sample, | ||
}), | ||
}); | ||
render(<GradersManager sections={{}} course_id={1} assignment_id={1} />); | ||
}); | ||
|
||
it("contains the correct amount of inactive groups in the hidden tooltip", () => { | ||
expect(screen.getByTestId("show_hidden_groups_tooltip").getAttribute("title")).toEqual( | ||
"1 inactive group" | ||
); | ||
}); | ||
|
||
it("initially contains the active group", () => { | ||
expect(screen.getByText("group_0014")).toBeInTheDocument(); | ||
}); | ||
|
||
it("contains the inactive group after a single toggle", () => { | ||
fireEvent.click(screen.getByTestId("show_hidden_groups")); | ||
expect(screen.getByText("group_0015")).toBeInTheDocument(); | ||
}); | ||
|
||
it("doesn't contain the inactive group after two toggles", () => { | ||
fireEvent.click(screen.getByTestId("show_hidden_groups")); | ||
fireEvent.click(screen.getByTestId("show_hidden_groups")); | ||
expect(screen.queryByText("group_0015")).not.toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1082,7 +1082,7 @@ def current_grader_data | |
} | ||
end | ||
|
||
{ | ||
result = { | ||
groups: groups, | ||
criteria: criteria, | ||
graders: graders, | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. This isn't necessary |
||
|
||
members_data = assignment.groupings.joins(student_memberships: { role: :user }) | ||
.pluck('groupings.id', 'users.user_name', 'memberships.membership_status', 'roles.hidden') | ||
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. This isn't necessary |
||
|
||
result[:groups].each { |group| group[:members] = grouped_data[group[:_id]] } | ||
|
||
result | ||
end | ||
|
||
# Retrieve data for submissions table. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.