Skip to content

Commit ab567b1

Browse files
authored
fixed SingleTargetOverviewe link (#48)
1 parent a890b83 commit ab567b1

File tree

7 files changed

+66
-64
lines changed

7 files changed

+66
-64
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ module.exports = {
2323
],
2424
'no-underscore-dangle': ['error', { allow: ['__typename'] }],
2525
'no-console': 'off',
26+
'no-plusplus': 'off',
2627
},
2728
};

graphql.schema.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5470,9 +5470,13 @@
54705470
}
54715471
],
54725472
"type": {
5473-
"kind": "OBJECT",
5474-
"name": "ClassMissionMastery",
5475-
"ofType": null
5473+
"kind": "NON_NULL",
5474+
"name": null,
5475+
"ofType": {
5476+
"kind": "OBJECT",
5477+
"name": "ClassMissionMastery",
5478+
"ofType": null
5479+
}
54765480
},
54775481
"isDeprecated": false,
54785482
"deprecationReason": null

src/Components/LinearProgressWithLabel/ObjectiveDropDown.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ const DoublePaddedDiv = styled.div`
107107
export interface ObjectiveDropDownProps {
108108
name: string;
109109
tasks: TaskObjectiveProgress[];
110+
username: string;
110111
}
111112

112113
function getTaskObjectivePorgress(task: TaskObjectiveProgress) {
@@ -171,7 +172,7 @@ function getTaskPercent(mastery: string) {
171172
return 1;
172173
}
173174

174-
export default function ObjectiveDropDown({ name, tasks }: ObjectiveDropDownProps) {
175+
export default function ObjectiveDropDown({ name, tasks, username }: ObjectiveDropDownProps) {
175176
const classes = useStyles();
176177
const [open, setOpen] = useState(false);
177178

@@ -191,7 +192,7 @@ export default function ObjectiveDropDown({ name, tasks }: ObjectiveDropDownProp
191192
{tasks.map((task: TaskObjectiveProgress) => (
192193
<Link
193194
to={{
194-
pathname: `/viewTask/${task.task.id}`,
195+
pathname: `/viewTask/${task.task.id}/${username}`,
195196
state: getTaskObjectivePorgress(task),
196197
}}
197198
>

src/Components/SingleTargetOverview/SingleTargetOverview.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ function getTargetData(targetData1: TargetProgress[], name: string) {
9292
export default function SingleTargetOveriew() {
9393
const history = useHistory();
9494
const { name } = useParams<Record<string, string | undefined>>();
95+
96+
const username = 'Google_114813486146105420824';
97+
9598
const test: any = history.location.state;
9699
const inputUser: User = {
97100
id: test?.id,
@@ -101,7 +104,7 @@ export default function SingleTargetOveriew() {
101104
const { data, loading, error } = useGetTargetProgressQuery({
102105
variables: {
103106
courseId: 'Integrated Science',
104-
username: 'Google_118280657086683968595',
107+
username,
105108
},
106109
});
107110

@@ -153,7 +156,11 @@ export default function SingleTargetOveriew() {
153156
<RowDiv className="row">
154157
<TargetColumnDiv className="col-12">
155158
{targetData?.objectives.map((objective: ObjectiveProgress) => (
156-
<ObjectiveDropDown name={objective.objectiveName} tasks={objective.tasks} />
159+
<ObjectiveDropDown
160+
name={objective.objectiveName}
161+
tasks={objective.tasks}
162+
username={username}
163+
/>
157164
))}
158165
</TargetColumnDiv>
159166
</RowDiv>

src/Components/StudentOverview/LTStudentViewTable.tsx

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/* eslint-disable @typescript-eslint/no-unsafe-call */
77
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
88
/* eslint-disable no-restricted-syntax */
9+
910
import { useHistory } from 'react-router-dom';
1011
import { useQuery } from '@apollo/client';
1112
import React, { useState } from 'react';
@@ -19,6 +20,20 @@ import {
1920
import { LIST_TARGETS_BY_COURSE } from '../../hooks/ListTargetsByCourse';
2021
import SelectedLTStudentViewTable from './SelectedLTStudentViewTable';
2122

23+
interface LTStudentViewRow {
24+
row: {
25+
section: string;
26+
name: string;
27+
firstname: string;
28+
lastname: string;
29+
team?: string;
30+
recent: string;
31+
average: string;
32+
progress: string;
33+
studentId: string;
34+
};
35+
}
36+
2237
function LTStudentViewTable() {
2338
const { data: missionMasteryData } = useClassMissionMasteryQuery();
2439

@@ -39,36 +54,33 @@ function LTStudentViewTable() {
3954
return <div />;
4055
}
4156

42-
const rowClicked = (userName: string) => {
57+
const rowClicked = (row: LTStudentViewRow) => {
4358
history.push({
44-
pathname: '/singleStudentMasteryOverview',
45-
state: { id: '', firstName: userName, lastName: ' ' },
59+
pathname: `/singleStudentMasteryOverview/${row.row.studentId}`,
60+
state: { id: row.row.studentId, firstname: row.row.firstname, lastname: row.row.lastname },
4661
});
4762
};
4863

49-
const data: any[] = [];
50-
missionMasteryData?.classMissionMastery?.studentMissionMasteryList.map(
51-
(studentMissionMastery: CmStudentFieldsFragment) =>
52-
data.push({
53-
row: {
54-
section: '1',
55-
name: `${studentMissionMastery.student.lastName} ${studentMissionMastery.student.firstName}`,
56-
team: studentMissionMastery.student.team,
57-
recent: studentMissionMastery.currentTaskName,
58-
average: '',
59-
progress: `${(studentMissionMastery.progress * 100).toFixed(1)}%`,
60-
},
61-
})
62-
);
63-
64-
// TODO remove when names are populated
65-
data.forEach((dataEntry) => {
66-
if (dataEntry.row.name.indexOf('null') !== -1) {
67-
dataEntry.row.name = 'Mary Lee';
68-
}
69-
if (dataEntry.row.name.length > 25) {
70-
dataEntry.row.name = dataEntry.row.name.substring(0, 25);
71-
}
64+
const studentMissionMasteryList: CmStudentFieldsFragment[] =
65+
missionMasteryData?.classMissionMastery?.studentMissionMasteryList || [];
66+
67+
const data: LTStudentViewRow[] = studentMissionMasteryList.map((studentMissionMastery) => {
68+
const firstname = studentMissionMastery.student.firstName || 'Mary';
69+
const lastname = studentMissionMastery.student.lastName || 'Lee';
70+
71+
return {
72+
row: {
73+
section: '1',
74+
name: `${firstname} ${lastname}`,
75+
firstname,
76+
lastname,
77+
team: studentMissionMastery.student.team,
78+
recent: studentMissionMastery.currentTaskName,
79+
average: '',
80+
progress: `${(studentMissionMastery.progress * 100).toFixed(1)}%`,
81+
studentId: studentMissionMastery.student.studentId,
82+
},
83+
};
7284
});
7385

7486
console.log(data);

src/Screens/TaskView/Rubric/RubricMenu.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@ import {
88
useTheme,
99
Typography,
1010
} from '@material-ui/core';
11-
import { Form, Button, NavDropdown } from 'react-bootstrap';
11+
import { Form, NavDropdown } from 'react-bootstrap';
1212
import { ChevronLeft, ChevronRight, Menu } from '@material-ui/icons';
1313
import clsx from 'clsx';
1414
import React from 'react';
15-
import {
16-
RubricRequirement,
17-
TaskObjectiveProgress,
18-
useGetObjectiveByIdQuery,
19-
} from '../../../__generated__/types';
15+
import { RubricRequirement } from '../../../__generated__/types';
2016
import Rubric from './Rubric';
2117
import ObjectiveRubric from './ObjectiveRubric';
2218

src/__generated__/types.ts

Lines changed: 6 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)