Skip to content

Commit

Permalink
Simplify Bulk Management Config (#200)
Browse files Browse the repository at this point in the history
* refactor: simplify bulk management enabling

Formerly, a course had to have bulk management enabled and have a master's
track. This painted us into a corner where we had to create a
workaround for enabling bulk management on non-master's track courses.
Instead, this relies only on an enabled flag from edx-platform (based on
a course waffle flag) which simplifies the enabling code here.

* feat: remove unneeded bulk management allow-list
  • Loading branch information
nsprenkle authored Aug 4, 2021
1 parent e8a8cca commit 650e932
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 98 deletions.
1 change: 0 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ ENTERPRISE_MARKETING_URL=''
ENTERPRISE_MARKETING_UTM_SOURCE=''
ENTERPRISE_MARKETING_UTM_CAMPAIGN=''
ENTERPRISE_MARKETING_FOOTER_UTM_MEDIUM=''
BULK_MANAGEMENT_SPECIAL_ACCESS_COURSE_IDS=''
1 change: 0 additions & 1 deletion .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ ENTERPRISE_MARKETING_URL='http://example.com'
ENTERPRISE_MARKETING_UTM_SOURCE='example.com'
ENTERPRISE_MARKETING_UTM_CAMPAIGN='example.com Referral'
ENTERPRISE_MARKETING_FOOTER_UTM_MEDIUM='Footer'
BULK_MANAGEMENT_SPECIAL_ACCESS_COURSE_IDS=''
2 changes: 1 addition & 1 deletion documentation/testing/test-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Confirm the following workflows:
- [ ] Clicking "Save Grade" applies the override, shows the successful "grade has been edited" banner and updates score in grades table (may take a few seconds).
- [ ] Opening back up the "Edit Grades" modal shows the change as an entry in the override history table.

- [ ] *Masters only*: "Bulk Management" allows overriding grades in bulk.
- [ ] *Master's (or selectively-enabled) only*: "Bulk Management" allows overriding grades in bulk.
- Open a non-masters-track course.
- [ ] Verify that the "Bulk Management" tab does not appear.
- [ ] Verify that the "Bulk Management" button does not appear.
Expand Down
10 changes: 8 additions & 2 deletions documentation/testing/test-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Suggested resources:
- [Adding Exercises and Tools](https://edx.readthedocs.io/projects/edx-partner-course-staff/en/latest/grading/index.html)
- [Set the Assignment Type and Due Date for a Subsection](https://edx.readthedocs.io/projects/edx-partner-course-staff/en/latest/developing_course/course_subsections.html#set-the-assignment-type-and-due-date-for-a-subsection)

## Enable Gradebook and feature toggles for course
## Enable Gradebook for course

See README.md #Quickstart for more detailed instructions.

Expand All @@ -25,7 +25,13 @@ As an admin user, visit Django Admin (`{lms-url}/admin`) to modify features.
- [ ] Set name to `grades.assume_zero_grade_if_absent`, select "Active", and click "Save"
- In Waffle_Utils > Waffle flag course overrides:
- [ ] Add a new flag called `grades.writeable_gradebook`, select "Force On", and enable it for your course
- [ ] Add a new flag called `grades.bulk_management`, select "Force On", and enable it for your course

## Enable Bulk Management

Bulk Management is an added feature to allow modifying grades in bulk via CSV upload. Bulk Management is default enabled for Master's track courses but can be selectively enabled for other courses with a waffle flag following the steps below.

- In Waffle_Utils > Waffle flag course overrides:
- [ ] Add a new flag called `grades.bulk_management`, select "Force On", and enable it for your course.

## Create a Master's track for testing Master's-only features

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@edx/frontend-app-gradebook",
"version": "1.4.45",
"version": "1.4.46",
"description": "edx editable gradebook-ui to manipulate grade overrides on subsections",
"repository": {
"type": "git",
Expand Down
10 changes: 2 additions & 8 deletions src/data/selectors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import cohorts from './cohorts';
import filters from './filters';
import grades, { minGrade, maxGrade } from './grades';
import roles from './roles';
import special from './special';
import tracks from './tracks';

const {
Expand Down Expand Up @@ -218,15 +217,11 @@ export const shouldShowSpinner = (state) => (

/**
* showBulkManagement(state, options)
* Returns true iff the user has special access or bulk management is configured to be available
* and the course has a masters track.
* Returns true iff the course has bulk management enabled
* @param {object} state - redux state
* @return {bool} - should show bulk management controls?
*/
export const showBulkManagement = (state) => (
special.hasSpecialBulkManagementAccess(app.courseId(state))
|| (tracks.stateHasMastersTrack(state) && state.config.bulkManagementAvailable)
);
export const showBulkManagement = (state) => (state.config.bulkManagementAvailable);

export default StrictDict({
root: StrictDict({
Expand All @@ -247,6 +242,5 @@ export default StrictDict({
filters,
grades,
roles,
special,
tracks,
});
38 changes: 4 additions & 34 deletions src/data/selectors/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,43 +493,13 @@ describe('root selectors', () => {
});
});
describe('showBulkManagement', () => {
const mockAccess = (val) => {
selectors.special.hasSpecialBulkManagementAccess = jest.fn(() => val);
};
const mockHasMastersTrack = (val) => {
selectors.tracks.stateHasMastersTrack = jest.fn(() => val);
};
const selector = moduleSelectors.showBulkManagement;
const mkState = (bulkManagementAvailable) => ({ config: { bulkManagementAvailable } });
describe('user has special bulk management access', () => {
it('returns true', () => {
mockAccess(true);
mockHasMastersTrack(false);
expect(selector(mkState(true))).toEqual(true);
});
it('returns true when bulk management is enabled for the course', () => {
expect(selector(mkState(true))).toEqual(true);
});
describe('user does not have special access', () => {
beforeEach(() => {
mockAccess(false);
});
describe('course has a masters track, but bulkManagement not available', () => {
it('returns false', () => {
mockHasMastersTrack(true);
expect(selector(mkState(false))).toEqual(false);
});
});
describe('course does not have a masters track, but bulkManagement available', () => {
it('returns false', () => {
mockHasMastersTrack(false);
expect(selector(mkState(true))).toEqual(false);
});
});
describe('course has a masters track, and bulkManagement is available', () => {
it('returns false', () => {
mockHasMastersTrack(true);
expect(selector(mkState(true))).toEqual(true);
});
});
it('returns false when bulk management is not enabled for the course', () => {
expect(selector(mkState(false))).toEqual(false);
});
});
});
22 changes: 0 additions & 22 deletions src/data/selectors/special.js

This file was deleted.

27 changes: 0 additions & 27 deletions src/data/selectors/special.test.js

This file was deleted.

0 comments on commit 650e932

Please sign in to comment.