Skip to content

Commit 4143b87

Browse files
authored
Remove grading summary (#2790)
* Remove grading summary card * Remove grading summary component * Refactor grading component Move menu options outside component, preventing unnecessary object recreations.
1 parent 9c9abdd commit 4143b87

File tree

2 files changed

+49
-190
lines changed

2 files changed

+49
-190
lines changed

src/pages/academy/grading/Grading.tsx

Lines changed: 49 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ import '@tremor/react/dist/esm/tremor.css';
22

33
import { Icon as BpIcon, NonIdealState, Position, Spinner, SpinnerSize } from '@blueprintjs/core';
44
import { IconNames } from '@blueprintjs/icons';
5-
import { Button, Card, Col, ColGrid, Flex, Text, Title } from '@tremor/react';
5+
import { Button, Card, Flex, Text, Title } from '@tremor/react';
66
import React, { useEffect, useState } from 'react';
77
import { useDispatch } from 'react-redux';
88
import { Navigate, useParams } from 'react-router';
99
import { fetchGradingOverviews } from 'src/commons/application/actions/SessionActions';
1010
import { Role } from 'src/commons/application/ApplicationTypes';
11-
import { GradingStatuses } from 'src/commons/assessment/AssessmentTypes';
1211
import SimpleDropdown from 'src/commons/SimpleDropdown';
1312
import { useSession } from 'src/commons/utils/Hooks';
1413
import { numberRegExp } from 'src/features/academy/AcademyTypes';
@@ -17,39 +16,31 @@ import { exportGradingCSV, isSubmissionUngraded } from 'src/features/grading/Gra
1716
import ContentDisplay from '../../../commons/ContentDisplay';
1817
import { convertParamToInt } from '../../../commons/utils/ParamParseHelper';
1918
import GradingSubmissionsTable from './subcomponents/GradingSubmissionsTable';
20-
import GradingSummary from './subcomponents/GradingSummary';
2119
import GradingWorkspace from './subcomponents/GradingWorkspace';
2220

21+
const groupOptions = [
22+
{ value: false, label: 'my groups' },
23+
{ value: true, label: 'all groups' }
24+
];
25+
26+
const showOptions = [
27+
{ value: false, label: 'ungraded' },
28+
{ value: true, label: 'all' }
29+
];
30+
2331
const Grading: React.FC = () => {
24-
const {
25-
courseId,
26-
gradingOverviews,
27-
role,
28-
group,
29-
assessmentOverviews: assessments = []
30-
} = useSession();
31-
const params = useParams<{
32-
submissionId: string;
33-
questionId: string;
34-
}>();
32+
const { courseId, gradingOverviews, role, group } = useSession();
33+
const params = useParams<{ submissionId: string; questionId: string }>();
3534

3635
const isAdmin = role === Role.Admin;
3736
const [showAllGroups, setShowAllGroups] = useState(isAdmin || group === null);
38-
const groupOptions = [
39-
{ value: false, label: 'my groups' },
40-
{ value: true, label: 'all groups' }
41-
];
4237

4338
const dispatch = useDispatch();
4439
useEffect(() => {
4540
dispatch(fetchGradingOverviews(!showAllGroups));
4641
}, [dispatch, role, showAllGroups]);
4742

4843
const [showAllSubmissions, setShowAllSubmissions] = useState(false);
49-
const showOptions = [
50-
{ value: false, label: 'ungraded' },
51-
{ value: true, label: 'all' }
52-
];
5344

5445
// If submissionId or questionId is defined but not numeric, redirect back to the Grading overviews page
5546
if (
@@ -88,63 +79,42 @@ const Grading: React.FC = () => {
8879
gradingOverviews === undefined ? (
8980
loadingDisplay
9081
) : (
91-
<ColGrid numColsLg={8} gapX="gap-x-4" gapY="gap-y-2">
92-
<Col numColSpanLg={6}>
93-
<Card>
94-
<Flex justifyContent="justify-between">
95-
<Flex justifyContent="justify-start" spaceX="space-x-6">
96-
<Title>Submissions</Title>
97-
<Button
98-
variant="light"
99-
size="xs"
100-
icon={() => (
101-
<BpIcon icon={IconNames.EXPORT} style={{ marginRight: '0.5rem' }} />
102-
)}
103-
onClick={() => exportGradingCSV(gradingOverviews)}
104-
>
105-
Export to CSV
106-
</Button>
107-
</Flex>
108-
</Flex>
109-
<Flex justifyContent="justify-start" marginTop="mt-2" spaceX="space-x-2">
110-
<Text>Viewing</Text>
111-
<SimpleDropdown
112-
options={showOptions}
113-
selectedValue={showAllSubmissions}
114-
onClick={setShowAllSubmissions}
115-
popoverProps={{ position: Position.BOTTOM }}
116-
buttonProps={{ minimal: true, rightIcon: 'caret-down' }}
117-
/>
118-
<Text>submissions from</Text>
119-
<SimpleDropdown
120-
options={groupOptions}
121-
selectedValue={showAllGroups}
122-
onClick={setShowAllGroups}
123-
popoverProps={{ position: Position.BOTTOM }}
124-
buttonProps={{ minimal: true, rightIcon: 'caret-down' }}
125-
/>
126-
</Flex>
127-
<GradingSubmissionsTable
128-
submissions={submissions.filter(
129-
s => showAllSubmissions || isSubmissionUngraded(s)
130-
)}
131-
/>
132-
</Card>
133-
</Col>
134-
135-
<Col numColSpanLg={2}>
136-
<Card hFull>
137-
<GradingSummary
138-
// Only include submissions from the same group in the summary
139-
submissions={submissions.filter(
140-
({ groupName, gradingStatus }) =>
141-
groupName === group && gradingStatus !== GradingStatuses.excluded
142-
)}
143-
assessments={assessments}
144-
/>
145-
</Card>
146-
</Col>
147-
</ColGrid>
82+
<Card>
83+
<Flex justifyContent="justify-between">
84+
<Flex justifyContent="justify-start" spaceX="space-x-6">
85+
<Title>Submissions</Title>
86+
<Button
87+
variant="light"
88+
size="xs"
89+
icon={() => <BpIcon icon={IconNames.EXPORT} style={{ marginRight: '0.5rem' }} />}
90+
onClick={() => exportGradingCSV(gradingOverviews)}
91+
>
92+
Export to CSV
93+
</Button>
94+
</Flex>
95+
</Flex>
96+
<Flex justifyContent="justify-start" marginTop="mt-2" spaceX="space-x-2">
97+
<Text>Viewing</Text>
98+
<SimpleDropdown
99+
options={showOptions}
100+
selectedValue={showAllSubmissions}
101+
onClick={setShowAllSubmissions}
102+
popoverProps={{ position: Position.BOTTOM }}
103+
buttonProps={{ minimal: true, rightIcon: 'caret-down' }}
104+
/>
105+
<Text>submissions from</Text>
106+
<SimpleDropdown
107+
options={groupOptions}
108+
selectedValue={showAllGroups}
109+
onClick={setShowAllGroups}
110+
popoverProps={{ position: Position.BOTTOM }}
111+
buttonProps={{ minimal: true, rightIcon: 'caret-down' }}
112+
/>
113+
</Flex>
114+
<GradingSubmissionsTable
115+
submissions={submissions.filter(s => showAllSubmissions || isSubmissionUngraded(s))}
116+
/>
117+
</Card>
148118
)
149119
}
150120
fullWidth={true}

src/pages/academy/grading/subcomponents/GradingSummary.tsx

Lines changed: 0 additions & 111 deletions
This file was deleted.

0 commit comments

Comments
 (0)