Skip to content

Commit fc4bacb

Browse files
committed
wip
1 parent aca759e commit fc4bacb

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/data/selectors/grades.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ export const formatMinAssignmentGrade = (percentGrade, options) => (
9292
* @param {string} label - assignment filter label
9393
* @return {string[]} - list of table headers
9494
*/
95-
export const headingMapper = (category, label = 'All') => {
95+
export const headingMapper = (
96+
category,
97+
label = 'All',
98+
hasMastersTrack,
99+
) => {
96100
const filters = {
97101
all: section => section.label,
98102
byCategory: section => section.label && section.category === category,
@@ -105,17 +109,25 @@ export const headingMapper = (category, label = 'All') => {
105109
} else {
106110
filter = filters.byLabel;
107111
}
112+
108113
const {
109114
username,
110115
fullName,
111116
email,
112117
totalGrade,
113118
} = Headings;
119+
let userIdentificationHeadings;
120+
if (hasMastersTrack) {
121+
userIdentificationHeadings = [username, fullName, email];
122+
} else {
123+
userIdentificationHeadings = [username];
124+
}
125+
114126
const filteredLabels = (entry) => entry.filter(filter).map(s => s.label);
115127

116128
return (entry) => (
117129
entry
118-
? [username, fullName, email, ...filteredLabels(entry), totalGrade]
130+
? [...userIdentificationHeadings, ...filteredLabels(entry), totalGrade]
119131
: []
120132
);
121133
};

src/data/selectors/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export const formattedGradeLimits = (state) => {
109109
export const getHeadings = (state) => grades.headingMapper(
110110
filters.assignmentType(state) || 'All',
111111
filters.selectedAssignmentLabel(state) || 'All',
112+
tracks.stateHasMastersTrack(state),
112113
)(grades.getExampleSectionBreakdown(state));
113114

114115
/**

0 commit comments

Comments
 (0)