Skip to content

Commit b7c201d

Browse files
committed
wip
1 parent 0e7d930 commit b7c201d

4 files changed

Lines changed: 159 additions & 106 deletions

File tree

hwproj.front/src/components/Common/GroupSelector.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const GroupSelector: FC<GroupSelectorProps> = (props) => {
126126
/>
127127
</Grid>
128128
{props.selectedGroupId && selectedGroup && <Grid item xs={12}>
129-
<Stack direction={"column"} spacing={1}>
129+
<Stack direction={"column"}>
130130
<Autocomplete
131131
multiple
132132
fullWidth
@@ -175,10 +175,11 @@ const GroupSelector: FC<GroupSelectorProps> = (props) => {
175175
<Button
176176
onClick={handleSubmitEdit}
177177
color="primary"
178-
variant="outlined"
178+
size="small"
179+
variant="contained"
179180
disabled={isSubmitting || !formState.name.trim() || formState.memberIds.length === 0}
180181
>
181-
{isSubmitting ? <CircularProgress size={24}/> : selectedGroup ? "Сохранить" : "Создать"}
182+
{isSubmitting ? <CircularProgress size={24}/> : "Сохранить группу"}
182183
</Button>
183184
</Stack>
184185
</Grid>}

hwproj.front/src/components/Courses/CourseExperimental.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import ArrowUpwardIcon from '@mui/icons-material/ArrowUpward';
3636
import SwitchAccessShortcutIcon from '@mui/icons-material/SwitchAccessShortcut';
3737
import Lodash from "lodash";
3838
import {CourseUnitType} from "@/components/Files/CourseUnitType";
39+
import GroupIcon from '@mui/icons-material/Group';
3940

4041
interface ICourseExperimentalProps {
4142
homeworks: HomeworkViewModel[]
@@ -573,13 +574,17 @@ export const CourseExperimental: FC<ICourseExperimentalProps> = (props) => {
573574
}
574575
}))
575576
}}>
576-
<Typography variant="h6" style={{fontSize: 18}} align={"center"}
577-
color={x.isDeferred
578-
? "textSecondary"
579-
: x.tags!.includes(TestTag) ? "primary" : "textPrimary"}>
580-
{isMentor && renderHomeworkStatus(x)}
581-
{x.title}{getTip(x)}
582-
</Typography>
577+
<Stack direction={"column"} alignItems={"center"}>
578+
{x.groupId && <GroupIcon fontSize={"small"}
579+
color={x.isDeferred ? "disabled" : x.tags!.includes(TestTag) ? "primary" : "action"}/>}
580+
<Typography variant="h6" style={{fontSize: 18}} align={"center"}
581+
color={x.isDeferred
582+
? "textSecondary"
583+
: x.tags!.includes(TestTag) ? "primary" : "textPrimary"}>
584+
{isMentor && renderHomeworkStatus(x)}
585+
{x.title}{getTip(x)}
586+
</Typography>
587+
</Stack>
583588
{x.isDeferred && !x.publicationDateNotSet &&
584589
<Typography style={{fontSize: "14px"}} align={"center"}>
585590
{"🕘 " + renderDate(x.publicationDate!) + " " + renderTime(x.publicationDate!)}

hwproj.front/src/components/Courses/StudentStats.tsx

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {CourseViewModel, GroupViewModel, HomeworkViewModel, StatisticsCourseMate
33
import {useNavigate, useParams} from 'react-router-dom';
44
import {LinearProgress, Table, TableBody, TableCell, TableContainer, TableHead, TableRow} from "@material-ui/core";
55
import StudentStatsCell from "../Tasks/StudentStatsCell";
6-
import {Alert, Button, Chip, IconButton, Typography} from "@mui/material";
6+
import {Alert, Button, Chip, IconButton, Stack, Typography} from "@mui/material";
77
import {grey} from "@material-ui/core/colors";
88
import StudentStatsUtils from "../../services/StudentStatsUtils";
99
import ShowChartIcon from "@mui/icons-material/ShowChart";
@@ -12,6 +12,7 @@ import Lodash from "lodash"
1212
import ApiSingleton from "@/api/ApiSingleton";
1313
import FullscreenIcon from '@mui/icons-material/Fullscreen';
1414
import FullscreenExitIcon from '@mui/icons-material/FullscreenExit';
15+
import GroupIcon from '@mui/icons-material/Group';
1516

1617
interface IStudentStatsProps {
1718
course: CourseViewModel;
@@ -116,7 +117,7 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
116117
const testsMaxSum = testGroups
117118
.map(h => h[0])
118119
.flatMap(homework => homework.tasks)
119-
.reduce((sum, task) =>
120+
.reduce((sum, task) =>
120121
sum + (task!.tags!.includes(BonusTag) ? 0 : (task!.maxRating || 0)), 0)
121122

122123
const hasHomeworks = !!notTests
@@ -257,12 +258,12 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
257258
)
258259
.reduce((sum, rating) => sum + rating, 0)
259260
const homeworksMaxSum = notTests
260-
.filter(h => !h.tags!.includes(BonusTag) &&
261-
(props.groups.find(g => g.id === h.groupId)?.studentsIds?.includes(cm.id!) || !h.groupId))
262-
.flatMap(homework => homework.tasks)
263-
.reduce((sum, task) => {
264-
return sum + (task!.tags!.includes(BonusTag) ? 0 : (task!.maxRating || 0));
265-
}, 0)
261+
.filter(h => !h.tags!.includes(BonusTag) &&
262+
(props.groups.find(g => g.id === h.groupId)?.studentsIds?.includes(cm.id!) || !h.groupId))
263+
.flatMap(homework => homework.tasks)
264+
.reduce((sum, task) => {
265+
return sum + (task!.tags!.includes(BonusTag) ? 0 : (task!.maxRating || 0));
266+
}, 0)
266267

267268
const testsSum = testGroups
268269
.map(group => {
@@ -285,6 +286,8 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
285286
.filter(x => x === cm.id)
286287
.toArray().length
287288

289+
const studentGroups = props.groups.filter(x => x.studentsIds!.includes(cm.id!))
290+
288291
return (
289292
<TableRow key={index} hover style={{height: 50}}>
290293
<TableCell
@@ -296,6 +299,21 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
296299
variant={"head"}
297300
>
298301
{cm.surname} {cm.name}
302+
{studentGroups.length > 0 && <Typography
303+
gutterBottom
304+
style={{
305+
color: "GrayText",
306+
fontSize: "12px",
307+
lineHeight: '1.2'
308+
}}
309+
>
310+
<Stack direction="row" spacing={1}>
311+
<GroupIcon style={{fontSize: "12px"}}/>
312+
<div>{studentGroups
313+
.map(r => r.name)
314+
.join(', ')}</div>
315+
</Stack>
316+
</Typography>}
299317
<Typography
300318
style={{
301319
color: "GrayText",

0 commit comments

Comments
 (0)