Skip to content

Commit 8fe325c

Browse files
author
Martin Krulis
committed
Best solutions are now distinguished by different icon in the assignment solutions table.
1 parent 55a4ed7 commit 8fe325c

File tree

6 files changed

+41
-10
lines changed

6 files changed

+41
-10
lines changed

src/components/Assignments/Assignment/AssignmentStatusIcon/AssignmentStatusIcon.js

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,27 @@ export const getStatusDesc = (status, lastSubmission) => {
1111
return status === 'work-in-progress' && !lastSubmission ? 'missing-submission' : status;
1212
};
1313

14-
const AssignmentStatusIcon = ({ id, status, accepted = false }) => {
14+
const AssignmentStatusIcon = ({ id, status, accepted = false, isBestSolution = false }) => {
1515
switch (status) {
1616
case 'done':
1717
return (
1818
<StatusIcon
1919
id={id}
2020
accepted={accepted}
21-
icon={<Icon icon={['far', 'thumbs-up']} className="text-green" />}
21+
icon={<Icon icon={isBestSolution ? 'thumbs-up' : ['far', 'thumbs-up']} className="text-green" />}
2222
message={
23-
<FormattedMessage id="app.assignemntStatusIcon.ok" defaultMessage="Assignment is successfully completed." />
23+
<React.Fragment>
24+
<FormattedMessage
25+
id="app.assignemntStatusIcon.ok"
26+
defaultMessage="Assignment is successfully completed."
27+
/>
28+
{isBestSolution && !accepted && (
29+
<FormattedMessage
30+
id="app.assignemntStatusIcon.isBestSolution"
31+
defaultMessage="This is the best solution of the author submitted so far."
32+
/>
33+
)}
34+
</React.Fragment>
2435
}
2536
/>
2637
);
@@ -44,12 +55,20 @@ const AssignmentStatusIcon = ({ id, status, accepted = false }) => {
4455
<StatusIcon
4556
id={id}
4657
accepted={accepted}
47-
icon={<Icon icon={['far', 'thumbs-down']} className="text-red" />}
58+
icon={<Icon icon={isBestSolution ? 'thumbs-down' : ['far', 'thumbs-down']} className="text-red" />}
4859
message={
49-
<FormattedMessage
50-
id="app.assignemntStatusIcon.failed"
51-
defaultMessage="No correct solution was submitted yet."
52-
/>
60+
<React.Fragment>
61+
<FormattedMessage
62+
id="app.assignemntStatusIcon.failed"
63+
defaultMessage="No correct solution was submitted yet."
64+
/>
65+
{isBestSolution && !accepted && (
66+
<FormattedMessage
67+
id="app.assignemntStatusIcon.isBestSolution"
68+
defaultMessage="This is the best solution of the author submitted so far."
69+
/>
70+
)}
71+
</React.Fragment>
5372
}
5473
/>
5574
);

src/components/Assignments/SolutionsTable/SolutionsTableRow.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const SolutionsTableRow = ({
2929
actualPoints,
3030
solution: { createdAt },
3131
accepted = false,
32+
isBestSolution = false,
3233
runtimeEnvironment = null,
3334
commentsStats = null,
3435
permissionHints = null,
@@ -57,7 +58,12 @@ const SolutionsTableRow = ({
5758
'valign-middle': true,
5859
'text-nowrap': !compact,
5960
})}>
60-
<AssignmentStatusIcon id={id} status={getStatusDesc(status, lastSubmission)} accepted={accepted} />
61+
<AssignmentStatusIcon
62+
id={id}
63+
status={getStatusDesc(status, lastSubmission)}
64+
accepted={accepted}
65+
isBestSolution={isBestSolution}
66+
/>
6167
<CommentsIcon id={id} commentsStats={commentsStats} gapLeft={!splitOnTwoLines} />
6268
</td>
6369

@@ -149,6 +155,7 @@ SolutionsTableRow.propTypes = {
149155
createdAt: PropTypes.number.isRequired,
150156
}),
151157
accepted: PropTypes.bool,
158+
isBestSolution: PropTypes.bool,
152159
commentsStats: PropTypes.object,
153160
runtimeEnvironment: PropTypes.object,
154161
permissionHints: PropTypes.object,

src/locales/cs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"app.assignemntStatusIcon.evaluationFailed": "Žádné řesení nebylo správně vyhodnoceno.",
4141
"app.assignemntStatusIcon.failed": "Žádné správné řešení nebylo zatím odevzdáno.",
4242
"app.assignemntStatusIcon.inProgress": "Řešení úlohy je právě vyhodnocováno.",
43+
"app.assignemntStatusIcon.isBestSolution": "Toto je nejlepší řešení, které autor dosud odevzdal.",
4344
"app.assignemntStatusIcon.none": "Zatím nebyla odevzdána žádná řešení.",
4445
"app.assignemntStatusIcon.ok": "Úloha byla úspěšně splněna.",
4546
"app.assignemntStatusIcon.solutionMissingSubmission": "Řešení nebylo odevzdáno k vyhodnocení pravděpodobně díky chybě. Budete ho muset odevzdat znovu.",

src/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"app.assignemntStatusIcon.evaluationFailed": "No solution was evaluated correctly by ReCodEx.",
4141
"app.assignemntStatusIcon.failed": "No correct solution was submitted yet.",
4242
"app.assignemntStatusIcon.inProgress": "Assignment solution is being evaluated.",
43+
"app.assignemntStatusIcon.isBestSolution": "This is the best solution of the author submitted so far.",
4344
"app.assignemntStatusIcon.none": "No solutions were submmitted so far.",
4445
"app.assignemntStatusIcon.ok": "Assignment is successfully completed.",
4546
"app.assignemntStatusIcon.solutionMissingSubmission": "The solution was not submitted for evaluation probably due to an error. You may need to resubmit it.",

src/locales/whitelist_en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"app.assignemntStatusIcon.evaluationFailed",
4141
"app.assignemntStatusIcon.failed",
4242
"app.assignemntStatusIcon.inProgress",
43+
"app.assignemntStatusIcon.isBestSolution",
4344
"app.assignemntStatusIcon.none",
4445
"app.assignemntStatusIcon.ok",
4546
"app.assignemntStatusIcon.solutionMissingSubmission",

src/pages/AssignmentStats/AssignmentStats.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ const prepareTableColumnDescriptors = defaultMemoize((loggedUserId, assignmentId
6868
info.lastSubmission
6969
)}
7070
accepted={info.accepted}
71+
isBestSolution={info.isBestSolution}
7172
/>
7273
<CommentsIcon id={info.id} commentsStats={info.commentsStats} gapLeft />
7374
</React.Fragment>
@@ -187,6 +188,7 @@ const prepareTableData = defaultMemoize((assigmentSolutions, users, runtimeEnvir
187188
bonusPoints,
188189
actualPoints,
189190
accepted,
191+
isBestSolution,
190192
commentsStats,
191193
permissionHints,
192194
}) => {
@@ -195,7 +197,7 @@ const prepareTableData = defaultMemoize((assigmentSolutions, users, runtimeEnvir
195197
(lastSubmission.evaluationStatus === 'done' || lastSubmission.evaluationStatus === 'failed');
196198
const userId = solution && solution.userId;
197199
return {
198-
icon: { id, commentsStats, lastSubmission, accepted },
200+
icon: { id, commentsStats, lastSubmission, accepted, isBestSolution },
199201
user: users.find(({ id }) => id === userId),
200202
date: solution && solution.createdAt,
201203
validity: statusEvaluated ? safeGet(lastSubmission, ['evaluation', 'score']) : null,

0 commit comments

Comments
 (0)