Skip to content

Commit ca8035a

Browse files
committed
Display resubmission author and runtime environment on ReferenceSolutionDetail page
1 parent 143e1e2 commit ca8035a

File tree

7 files changed

+58
-14
lines changed

7 files changed

+58
-14
lines changed

src/components/ReferenceSolutions/ReferenceSolutionDetail/ReferenceSolutionDetail.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class ReferenceSolutionDetail extends Component {
4545
evaluations,
4646
deleteEvaluation = null,
4747
refreshSolutionEvaluations = null,
48+
runtimeEnvironments,
4849
} = this.props;
4950
const { openFileId } = this.state;
5051
const evaluationsJS = evaluations && evaluations.toJS();
@@ -60,8 +61,15 @@ class ReferenceSolutionDetail extends Component {
6061
<Col md={6} sm={12}>
6162
<ReferenceSolutionStatus
6263
description={description}
63-
solution={{ createdAt, userId }}
64+
submittedAt={createdAt}
65+
userId={userId}
66+
submittedBy={submittedBy}
6467
exerciseId={exercise.id}
68+
environment={
69+
runtimeEnvironments &&
70+
runtimeEnvironmentId &&
71+
runtimeEnvironments.find(({ id }) => id === runtimeEnvironmentId)
72+
}
6573
/>
6674
<Row>
6775
{files.map(file => (
@@ -177,6 +185,7 @@ ReferenceSolutionDetail.propTypes = {
177185
evaluations: PropTypes.object.isRequired,
178186
deleteEvaluation: PropTypes.func,
179187
refreshSolutionEvaluations: PropTypes.func,
188+
runtimeEnvironments: PropTypes.array,
180189
};
181190

182191
export default ReferenceSolutionDetail;

src/components/ReferenceSolutions/ReferenceSolutionStatus/ReferenceSolutionStatus.js

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ import DateTime from '../../widgets/DateTime';
88
import UsersNameContainer from '../../../containers/UsersNameContainer';
99
import ExercisesNameContainer from '../../../containers/ExercisesNameContainer';
1010
import Icon, { EditIcon, CodeIcon } from '../../icons';
11+
import EnvironmentsListItem from '../../helpers/EnvironmentsList/EnvironmentsListItem';
1112

12-
const ReferenceSolutionStatus = ({ description, solution: { userId, createdAt }, exerciseId }) => (
13+
const ReferenceSolutionStatus = ({ description, userId, submittedAt, submittedBy, exerciseId, environment }) => (
1314
<Box
1415
title={
15-
<FormattedMessage id="app.referenceSolutionDetail.title.details" defaultMessage="Reference solution detail" />
16+
<FormattedMessage id="app.referenceSolutionDetail.title.details" defaultMessage="Reference Solution Detail" />
1617
}
1718
noPadding={true}
1819
collapsable={true}
@@ -28,6 +29,7 @@ const ReferenceSolutionStatus = ({ description, solution: { userId, createdAt },
2829
</th>
2930
<td>{exerciseId && <ExercisesNameContainer exerciseId={exerciseId} />}</td>
3031
</tr>
32+
3133
<tr>
3234
<td className="text-center">
3335
<EditIcon />
@@ -37,6 +39,7 @@ const ReferenceSolutionStatus = ({ description, solution: { userId, createdAt },
3739
</th>
3840
<td>{description}</td>
3941
</tr>
42+
4043
<tr>
4144
<td className="text-center">
4245
<Icon icon={['far', 'clock']} />
@@ -45,9 +48,10 @@ const ReferenceSolutionStatus = ({ description, solution: { userId, createdAt },
4548
<FormattedMessage id="generic.uploadedAt" defaultMessage="Uploaded at" />:
4649
</th>
4750
<td>
48-
<DateTime unixts={createdAt} showRelative />
51+
<DateTime unixts={submittedAt} showRelative />
4952
</td>
5053
</tr>
54+
5155
<tr>
5256
<td className="text-center">
5357
<Icon icon="user" />
@@ -59,18 +63,46 @@ const ReferenceSolutionStatus = ({ description, solution: { userId, createdAt },
5963
<UsersNameContainer userId={userId} />
6064
</td>
6165
</tr>
66+
67+
{Boolean(submittedBy) && submittedBy !== userId && (
68+
<tr>
69+
<td className="text-center">
70+
<Icon icon="user" />
71+
</td>
72+
<th className="text-nowrap">
73+
<FormattedMessage id="app.referenceSolution.reevaluatedBy" defaultMessage="Re-evaluated by" />:
74+
</th>
75+
<td>
76+
<UsersNameContainer userId={submittedBy} showEmail="icon" />
77+
</td>
78+
</tr>
79+
)}
80+
81+
{Boolean(environment) && Boolean(environment.name) && (
82+
<tr>
83+
<td className="text-center">
84+
<CodeIcon />
85+
</td>
86+
<th className="text-nowrap">
87+
<FormattedMessage id="app.solution.environment" defaultMessage="Target language:" />
88+
</th>
89+
<td>
90+
<EnvironmentsListItem runtimeEnvironment={environment} longNames={true} />
91+
</td>
92+
</tr>
93+
)}
6294
</tbody>
6395
</Table>
6496
</Box>
6597
);
6698

6799
ReferenceSolutionStatus.propTypes = {
68100
description: PropTypes.string.isRequired,
69-
solution: PropTypes.shape({
70-
userId: PropTypes.string.isRequired,
71-
createdAt: PropTypes.number.isRequired,
72-
}).isRequired,
101+
userId: PropTypes.string.isRequired,
102+
submittedBy: PropTypes.string.isRequired,
103+
submittedAt: PropTypes.number.isRequired,
73104
exerciseId: PropTypes.string.isRequired,
105+
environment: PropTypes.object,
74106
};
75107

76108
export default ReferenceSolutionStatus;

src/locales/cs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,7 @@
969969
"app.randomMessages.m9": "Nakreslit hrocha",
970970
"app.referenceSolution.exerciseBroken": "Úloha je rozbitá, a proto není v tuto chvíli možné nechat toto vzorové řešení znovu vyhodnotit.",
971971
"app.referenceSolution.exerciseNoLongerHasEnvironment": "Úloha již nepodporuje běhové prostředí, pod kterým bylo toto řešení odevzdáno. Řešení není možné znovu vyhodnotit.",
972+
"app.referenceSolution.reevaluatedBy": "Nechal znovu vyhodnotit",
972973
"app.referenceSolutionDetail.exercise": "Úloha",
973974
"app.referenceSolutionDetail.title.details": "Detail referenčního řešení",
974975
"app.referenceSolutionTable.noDescription": "popis nebyl uveden",

src/locales/en.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,8 @@
513513
"app.exercise.noReferenceSolutions": "There are no reference solutions for this exercise yet.",
514514
"app.exercise.overview": "Exercise overview",
515515
"app.exercise.referenceSolution.deleteConfirm": "Are you sure you want to delete the reference solution? This cannot be undone.",
516-
"app.exercise.referenceSolutionDetail": "Reference solution detail",
517-
"app.exercise.referenceSolutionTitle": "Reference solution overview",
516+
"app.exercise.referenceSolutionDetail": "Reference Solution Detail",
517+
"app.exercise.referenceSolutionTitle": "Reference Solution Overview",
518518
"app.exercise.referenceSolutionsBox": "Reference Solutions",
519519
"app.exercise.runtimes": "Runtime environments",
520520
"app.exercise.submitReferenceSoution": "Submit New Reference Solution",
@@ -969,8 +969,9 @@
969969
"app.randomMessages.m9": "Draw hippopotamus",
970970
"app.referenceSolution.exerciseBroken": "The exercise is broken. This reference solution may not be resubmitted at the moment.",
971971
"app.referenceSolution.exerciseNoLongerHasEnvironment": "The exercise no longer supports the environment for which this solution was evaluated. Resubmission is not possible.",
972+
"app.referenceSolution.reevaluatedBy": "Re-evaluated by",
972973
"app.referenceSolutionDetail.exercise": "Exercise",
973-
"app.referenceSolutionDetail.title.details": "Reference solution detail",
974+
"app.referenceSolutionDetail.title.details": "Reference Solution Detail",
974975
"app.referenceSolutionTable.noDescription": "no description given",
975976
"app.registration.description": "Start using ReCodEx today",
976977
"app.registration.title": "Create a new ReCodEx account",

src/locales/whitelist_en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,7 @@
969969
"app.randomMessages.m9",
970970
"app.referenceSolution.exerciseBroken",
971971
"app.referenceSolution.exerciseNoLongerHasEnvironment",
972+
"app.referenceSolution.reevaluatedBy",
972973
"app.referenceSolutionDetail.exercise",
973974
"app.referenceSolutionDetail.title.details",
974975
"app.referenceSolutionTable.noDescription",

src/pages/ReferenceSolution/ReferenceSolution.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { hasPermissions } from '../../helpers/common';
3030
const messages = defineMessages({
3131
title: {
3232
id: 'app.exercise.referenceSolutionTitle',
33-
defaultMessage: 'Reference solution overview',
33+
defaultMessage: 'Reference Solution Overview',
3434
},
3535
});
3636

@@ -87,7 +87,7 @@ class ReferenceSolution extends Component {
8787
},
8888
{
8989
text: (
90-
<FormattedMessage id="app.exercise.referenceSolutionDetail" defaultMessage="Reference solution detail" />
90+
<FormattedMessage id="app.exercise.referenceSolutionDetail" defaultMessage="Reference Solution Detail" />
9191
),
9292
iconName: ['far', 'gem'],
9393
},
@@ -129,6 +129,7 @@ class ReferenceSolution extends Component {
129129
exercise={exercise}
130130
deleteEvaluation={deleteEvaluation}
131131
refreshSolutionEvaluations={refreshSolutionEvaluations}
132+
runtimeEnvironments={exercise.runtimeEnvironments}
132133
/>
133134
)}
134135
</FetchManyResourceRenderer>

src/redux/middleware/apiMiddleware.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ const lastLocation = {
4848
search: null,
4949
};
5050

51-
5251
const middleware = ({ dispatch, getState }) => next => action => {
5352
switch (action && action.type) {
5453
case CALL_API:

0 commit comments

Comments
 (0)