-
Notifications
You must be signed in to change notification settings - Fork 253
ISSUE-7677: Display late penalty selection #7689
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
Merged
david-yz-liu
merged 10 commits into
master
from
ISSUE-7677_display_late_penalty_selection
Oct 10, 2025
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
cae59f1
ISSUE-7677: Display late penalty selection
49318bd
ISSUE-7677: Apply filter to extension column
7e165e9
ISSUE-7677: Normalize i18n keys
912be0b
ISSUE-7677: Update changelog
0a12265
ISSUE-7677: Add test cases
0b57a73
ISSUE:7677: Update test cases
2f4cbbe
ISSUE-7677: Update .gitignore configuration to exclude .devcontainer …
d3fc81a
ISSUE-7677: Small grammatic changes
26aed2c
ISSUE-7677: Suppress I18n duration warning
7873cdd
ISSUE-7677: Add name to list of contributors
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 hidden or 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 hidden or 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 hidden or 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
164 changes: 164 additions & 0 deletions
164
app/javascript/Components/__tests__/groups_manager.test.jsx
This file contains hidden or 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,164 @@ | ||
| import {render, screen} from "@testing-library/react"; | ||
| import {GroupsManager} from "../groups_manager"; | ||
| import {beforeEach, describe, expect, it} from "@jest/globals"; | ||
| import {getTimeExtension} from "../Helpers/table_helpers"; | ||
|
|
||
| jest.mock("@fortawesome/react-fontawesome", () => ({ | ||
| FontAwesomeIcon: () => { | ||
| return null; | ||
| }, | ||
| })); | ||
|
|
||
| const groupMock = [ | ||
| { | ||
| group_name: "c6scriab", | ||
| inactive: false, | ||
| instructor_approved: true, | ||
| members: [ | ||
| { | ||
| 0: "c6scriab", | ||
| 1: "inviter", | ||
| 2: false, | ||
| display_label: "(inviter)", | ||
| }, | ||
| ], | ||
| extension: { | ||
| apply_penalty: false, | ||
| grouping_id: 22, | ||
| id: null, | ||
| note: "", | ||
| }, | ||
| section: "", | ||
| }, | ||
| { | ||
| group_name: "group2", | ||
| inactive: false, | ||
| instructor_approved: true, | ||
| members: [ | ||
| { | ||
| 0: "student1", | ||
| 1: "inviter", | ||
| 2: false, | ||
| display_label: "(inviter)", | ||
| }, | ||
| ], | ||
| section: "", | ||
| extension: { | ||
| apply_penalty: true, | ||
| days: 2, | ||
| grouping_id: 16, | ||
| hours: 0, | ||
| id: 51, | ||
| minutes: 0, | ||
| note: "", | ||
| weeks: 0, | ||
| }, | ||
| }, | ||
| ]; | ||
| const studentMock = [ | ||
| { | ||
| assigned: true, | ||
| first_name: "coolStudent", | ||
| hidden: false, | ||
| id: 8, | ||
| last_name: "Alberic", | ||
| user_name: "student1", | ||
| }, | ||
| ]; | ||
|
|
||
| describe("GroupsManager", () => { | ||
| let filter_method = null; | ||
| let wrapper = React.createRef(); | ||
|
|
||
| beforeEach(async () => { | ||
| fetch.mockReset(); | ||
| fetch.mockResolvedValueOnce({ | ||
| ok: true, | ||
| json: jest.fn().mockResolvedValueOnce({ | ||
| templates: [], | ||
| groups: groupMock, | ||
| exam_templates: [], | ||
| students: studentMock, | ||
| clone_assignments: [], | ||
| }), | ||
| }); | ||
| const props = { | ||
| course_id: 1, | ||
| timed: false, | ||
| assignment_id: 2, | ||
| scanned_exam: false, | ||
| examTemplates: [], | ||
| times: ["weeks", "days", "hours", "minutes"], | ||
| }; | ||
| render(<GroupsManager {...props} ref={wrapper} />); | ||
| // wait for page to load and render content | ||
| await screen.findByText("abcd").catch(err => err); | ||
| // to view screen render: screen.debug(undefined, 300000) | ||
| }); | ||
|
|
||
| describe("DueDateExtensions", () => { | ||
| beforeEach(() => { | ||
| filter_method = | ||
| wrapper.current.groupsTable.wrapped.checkboxTable.props.columns[5].filterMethod; | ||
| }); | ||
|
|
||
| it("append (late submissions accepted) to assignments with extensions", async () => { | ||
| const groupWithExtension = groupMock[1]; | ||
| const timePeriods = ["weeks", "days", "hours", "minutes"]; | ||
| const timeExtension = getTimeExtension(groupWithExtension.extension, timePeriods); | ||
| const searchTerm = `${timeExtension} (${I18n.t("groups.late_submissions_accepted")})`; | ||
| expect(await screen.getByRole("link", {name: searchTerm})).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it("returns true when the selected value is all", () => { | ||
| expect(filter_method({value: "all"})).toEqual(true); | ||
| }); | ||
|
|
||
| describe("withExtension: false", () => { | ||
| it("returns true when assignments without an extension are present", () => { | ||
| const rowMock = {_original: {extension: {}}}; | ||
| const filterOptionsMock = JSON.stringify({withExtension: false}); | ||
| expect(filter_method({value: filterOptionsMock}, rowMock)).toEqual(true); | ||
| }); | ||
| it("returns false when assignments with an extension are present", () => { | ||
| const rowMock = {_original: {extension: {hours: 1}}}; | ||
| const filterOptionsMock = JSON.stringify({withExtension: false}); | ||
| expect(filter_method({value: filterOptionsMock}, rowMock)).toEqual(false); | ||
| }); | ||
| }); | ||
|
|
||
| describe("withExtension: true", () => { | ||
| describe("withLateSubmission: true", () => { | ||
| it("returns true when assignments have a late submission rule applied", () => { | ||
| const rowMock = {_original: {extension: {hours: 1, apply_penalty: true}}}; | ||
| const filterOptionsMock = JSON.stringify({withExtension: true, withLateSubmission: true}); | ||
| expect(filter_method({value: filterOptionsMock}, rowMock)).toEqual(true); | ||
| }); | ||
| it("returns false when assignments are missing an extension", () => { | ||
| const rowMock = {_original: {extension: {apply_penalty: true}}}; | ||
| const filterOptionsMock = JSON.stringify({withExtension: true, withLateSubmission: true}); | ||
| expect(filter_method({value: filterOptionsMock}, rowMock)).toEqual(false); | ||
| }); | ||
| }); | ||
| describe("withLateSubmission: false", () => { | ||
| it("returns true when assignments are missing an extension", () => { | ||
| const rowMock = {_original: {extension: {hours: 1, apply_penalty: true}}}; | ||
| const filterOptionsMock = JSON.stringify({ | ||
| withExtension: true, | ||
| withLateSubmission: false, | ||
| }); | ||
| expect(filter_method({value: filterOptionsMock}, rowMock)).toEqual(false); | ||
| }); | ||
|
|
||
| it("returns false when assignments have a late submission rule applied", () => { | ||
| const rowMock = {_original: {extension: {hours: 1, apply_penalty: true}}}; | ||
| const filterOptionsMock = JSON.stringify({ | ||
| withExtension: true, | ||
| withLateSubmission: false, | ||
| }); | ||
| expect(filter_method({value: filterOptionsMock}, rowMock)).toEqual(false); | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.