File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
src/Components/StudentOverview Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -17,13 +17,30 @@ import {
17
17
useClassTargetMasteryQuery ,
18
18
} from '../../__generated__/types' ;
19
19
20
+ function getUniqueObjectives ( objectives : Objective [ ] ) : Objective [ ] {
21
+ const uniqueObjectives : Objective [ ] = [ ] ;
22
+ const objectiveNameSet = new Set ( ) ;
23
+ objectives . forEach ( ( objective ) => {
24
+ if ( ! objectiveNameSet . has ( objective . objectiveName ) ) {
25
+ objectiveNameSet . add ( objective . objectiveName ) ;
26
+ uniqueObjectives . push ( objective ) ;
27
+ }
28
+ } ) ;
29
+
30
+ return uniqueObjectives ;
31
+ }
32
+
20
33
function genObjectiveGroup ( targetMasteryData : any ) : any {
21
34
const objectiveGorup : any = {
22
35
Header : 'Objectives' ,
23
36
columns : [ ] ,
24
37
} ;
25
38
26
- targetMasteryData . classTargetMastery . target . objectives . map ( ( objective : any ) => {
39
+ const uniqueObjectives = getUniqueObjectives (
40
+ targetMasteryData . classTargetMastery . target . objectives
41
+ ) ;
42
+
43
+ uniqueObjectives . forEach ( ( objective ) => {
27
44
objectiveGorup . columns . push ( {
28
45
Header : objective . objectiveName ,
29
46
accessor : `row.${ objective . objectiveId } ` ,
You can’t perform that action at this time.
0 commit comments