Skip to content

Commit e4c6214

Browse files
committed
StudentStats: отображение бонусных заданий
1 parent a10d25b commit e4c6214

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const isTestWork = (tagsOwner: { tags?: string[] }) => tagsOwner.tags?.in
1010
export const isBonusWork = (tagsOwner: { tags?: string[] }) => tagsOwner.tags?.includes(BonusTag) ?? false
1111

1212
export const TestTip: FC = () => <sup style={{color: "#2979ff"}}> тест</sup>
13-
const BonusTip: FC = () => <sup style={{color: "green"}}> бонус</sup>
13+
export const BonusTip: FC = () => <sup style={{color: "green"}}> бонус</sup>
1414
const TestBonusTip: FC = () => <sup style={{color: "#2979ff"}}> бонус</sup>
1515

1616
export const getTip = (tagsOwner: { tags?: string[] }) => {

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ 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";
10-
import {BonusTag, DefaultTags, TestTag} from "../Common/HomeworkTags";
10+
import {BonusTag, BonusTip, DefaultTags, TestTag} from "../Common/HomeworkTags";
1111
import Lodash from "lodash"
1212
import ApiSingleton from "@/api/ApiSingleton";
1313
import FullscreenIcon from '@mui/icons-material/Fullscreen';
@@ -113,7 +113,7 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
113113
})
114114
.values()
115115
.value();
116-
116+
117117
const testHomeworks = testGroups.map(x => x[0])
118118

119119
const homeworksWithGroups = notTests.filter(h => h.groupId)
@@ -153,6 +153,12 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
153153
.forEach(x => bestTaskSolutions.set(x.taskId!, x.studentId!))
154154
}
155155

156+
const renderTitle = (x: { title?: string, tags?: string[] }) => {
157+
return <>
158+
{x.title}{x.tags?.includes(BonusTag) && <BonusTip/>}
159+
</>
160+
}
161+
156162
return (
157163
<div>
158164
{props.solutions === undefined && <LinearProgress/>}
@@ -201,7 +207,7 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
201207
}}
202208
colSpan={homework.tasks!.length}
203209
>
204-
{homework.title}
210+
{renderTitle(homework)}
205211
</TableCell>)}
206212
</TableRow>
207213
<TableRow>
@@ -248,7 +254,7 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
248254
...homeworkStyles(homeworks, idx)
249255
}}
250256
key={task.id}>
251-
{task.title}
257+
{renderTitle(task)}
252258
</TableCell>
253259
))
254260
)}

0 commit comments

Comments
 (0)