Skip to content

Commit 7e1751f

Browse files
committed
StudentStats: количество лучших решений
1 parent 7f5b128 commit 7e1751f

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
9999

100100
const hasHomeworks = homeworksMaxSum > 0
101101
const hasTests = testsMaxSum > 0
102+
const showBestSolutions = isMentor
102103

103104
const bestTaskSolutions = new Map<number, string>()
104105
if (solutions && isMentor) {
@@ -139,7 +140,7 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
139140
</TableCell>
140141
{(hasHomeworks || hasTests) && <TableCell
141142
padding="checkbox"
142-
colSpan={(hasHomeworks ? 1 : 0) + (hasTests ? 1 : 0)}
143+
colSpan={(hasHomeworks ? 1 : 0) + (hasTests ? 1 : 0) + (showBestSolutions ? 1 : 0)}
143144
align="center"
144145
component="td"
145146
style={{
@@ -194,6 +195,10 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
194195
}}>
195196
КР ({testsMaxSum})
196197
</TableCell>}
198+
{showBestSolutions && <TableCell padding="checkbox" component="td" align="center"
199+
style={{borderLeft: borderStyle}}>
200+
🥇
201+
</TableCell>}
197202
{homeworks.map((homework, idx) =>
198203
homework.tasks!.map((task, i) => (
199204
<TableCell padding="checkbox" component="td" align="center"
@@ -239,6 +244,10 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
239244
.flat()
240245
.reduce((sum, rating) => sum + rating, 0)
241246

247+
const bestSolutionsCount = bestTaskSolutions.values()
248+
.filter(x => x === cm.id)
249+
.toArray().length
250+
242251
return (
243252
<TableRow key={index} hover style={{height: 50}}>
244253
<TableCell
@@ -268,7 +277,6 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
268277
padding="none"
269278
style={{
270279
borderLeft: borderStyle,
271-
backgroundColor: "white"
272280
}}
273281
component="td"
274282
scope="row"
@@ -286,7 +294,6 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
286294
padding="none"
287295
style={{
288296
borderLeft: borderStyle,
289-
backgroundColor: "white"
290297
}}
291298
component="td"
292299
scope="row"
@@ -299,6 +306,12 @@ const StudentStats: React.FC<IStudentStatsProps> = (props) => {
299306
}}
300307
label={testsSum}/>
301308
</TableCell>}
309+
{showBestSolutions && <TableCell
310+
align="center"
311+
padding="none"
312+
style={{borderLeft: borderStyle}}>
313+
<Typography variant={"caption"} color={"grey"}>{bestSolutionsCount}</Typography>
314+
</TableCell>}
302315
{homeworks.map((homework, idx) =>
303316
homework.tasks!.map((task, i) => {
304317
const additionalStyles = i === 0 && homeworkStyles(homeworks, idx)

hwproj.front/src/components/Tasks/StudentStatsCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const StudentStatsCell: FC<ITaskStudentCellProps & { borderLeftColor?: string }>
5858
};
5959

6060
return (
61-
<Tooltip arrow disableInteractive enterDelay={2000}
61+
<Tooltip arrow disableInteractive enterDelay={100}
6262
title={<span style={{whiteSpace: 'pre-line'}}>{tooltipTitle}</span>}>
6363
<TableCell
6464
onClick={handleCellClick}

0 commit comments

Comments
 (0)