Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibaud-Collyn committed May 23, 2024
2 parents 1a3553c + c761a8b commit 65603b6
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 54 deletions.
116 changes: 66 additions & 50 deletions frontend/app/[locale]/components/SubmissionDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useTranslation } from "react-i18next";
import React, { useEffect, useState } from "react";
import { getProjectFromSubmission, getSubmission, Project, Submission } from "@lib/api";
import { Button, Card, CardContent, Grid, LinearProgress, ThemeProvider, Divider, Typography } from "@mui/material";
import { Button, Card, CardContent, Grid, LinearProgress, ThemeProvider, Divider, Typography, Paper } from "@mui/material";
import ProjectReturnButton from "@app/[locale]/components/ProjectReturnButton";
import { baseTheme } from "@styles/theme";
import CheckIcon from "@mui/icons-material/Check";
Expand Down Expand Up @@ -95,7 +95,6 @@ const SubmissionDetailsPage: React.FC<SubmissionDetailsPageProps> = ({ locale, s
{`(${t("timestamp")}: ${formatDate(submission?.timestamp ?? "")})`}
</Typography>

<div>
{submission?.output_simple_test ? (
<Typography variant="subtitle1" style={{ fontWeight: 'bold' }}>
{t("simple_tests_ok")}
Expand All @@ -105,20 +104,58 @@ const SubmissionDetailsPage: React.FC<SubmissionDetailsPageProps> = ({ locale, s
{t("simple_tests_failed")}
</Typography>
)}
</div>
<div>
{submission?.eval_result ? (
<Typography variant="subtitle1" style={{ fontWeight: 'bold' }}>
{t("advanced_tests_ok")}
</Typography>
):(
<Typography variant="subtitle1" style={{ fontWeight: 'bold' }}>
{t("advanced_tests_failed")}
</Typography>
)}
</div>
{
!submission?.output_simple_test ? (
<>
<Divider style={{ marginBottom: '20px', marginTop: '20px' }}/>

{submission?.feedback_simple_test?.["0"].length > 0 ? (
<>
<Typography variant="h6" style={{ fontWeight: 'bold', marginBottom: '10px' }}>
{t("feedback_simple_test_0")}
</Typography>
{submission?.feedback_simple_test["0"].map((feedback, index) => (
<Typography key={index} variant="body1" style={{ marginBottom: '10px' }}>
{feedback}
</Typography>
))}
</>
) : null}

{submission?.feedback_simple_test?.["2"].length > 0 ? (
<>
<Typography variant="h6" style={{ fontWeight: 'bold', marginBottom: '10px' }}>
{t("feedback_simple_test_2")}
</Typography>
{submission?.feedback_simple_test["2"].map((feedback, index) => (
<Typography key={index} variant="body1" style={{ marginBottom: '10px' }}>
{feedback}
</Typography>
))}
</>
) : null}
</>
) : null
}
<Paper style={{ padding: '10px', marginTop: '10px' }}>
{submission?.eval_result ? (
<Typography variant="subtitle1" style={{ fontWeight: 'bold' }}>
{t("advanced_tests_ok")}
</Typography>
):(
<Typography variant="subtitle1" style={{ fontWeight: 'bold' }}>
{t("advanced_tests_failed")}
</Typography>
)}
{
submission?.eval_output ? (
<Typography variant="body1">
{submission?.eval_output}
</Typography>
) : null
}
</Paper>
</div>

</div>
</Grid>
<Grid item xs={12} sm={6} style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end' }}>
Expand All @@ -129,48 +166,27 @@ const SubmissionDetailsPage: React.FC<SubmissionDetailsPageProps> = ({ locale, s
variant="contained"
color="primary"
startIcon={<DownloadIcon />}
href={`${backend_url}/submissions/${submission_id}/download`}
href={`${backend_url}/submissions_${submission_id}`}
download
size="small"
>
{t("download_file")}
</Button>
<Typography variant="h6" gutterBottom style={{ fontWeight: 'bold', color: 'primary.main', marginBottom: '10px', marginTop: '40px' }}>
{t("artifacts")}
</Typography>
<Button
variant="contained"
color="primary"
startIcon={<DownloadIcon />}
href={`${backend_url}/submissions_${submission_id}_artifacts`}
download
size="small"
>
{t("download_artifacts")}
</Button>
</Grid>
</Grid>
{
!submission?.output_simple_test ? (
<>
<Divider style={{ marginBottom: '20px', marginTop: '20px' }}/>

{submission?.feedback_simple_test?.["0"].length > 0 ? (
<>
<Typography variant="h6" style={{ fontWeight: 'bold', marginBottom: '10px' }}>
{t("feedback_simple_test_0")}
</Typography>
{submission?.feedback_simple_test["0"].map((feedback, index) => (
<Typography key={index} variant="body1" style={{ marginBottom: '10px' }}>
{feedback}
</Typography>
))}
</>
) : null}

{submission?.feedback_simple_test?.["2"].length > 0 ? (
<>
<Typography variant="h6" style={{ fontWeight: 'bold', marginBottom: '10px' }}>
{t("feedback_simple_test_2")}
</Typography>
{submission?.feedback_simple_test["2"].map((feedback, index) => (
<Typography key={index} variant="body1" style={{ marginBottom: '10px' }}>
{feedback}
</Typography>
))}
</>
) : null}
</>
) : null
}

</CardContent>
</Card>
</Grid>
Expand Down
6 changes: 4 additions & 2 deletions frontend/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"visibility": "Visibility",
"year": "Year",
"archive_course": "Archive course",
"download_file": "Download",
"download_file": "Download files",
"denied": "Denied",
"show_more": "Show more",
"show_less": "Show less",
Expand Down Expand Up @@ -159,5 +159,7 @@
"simple_tests_failed": "File structure tests: Failed",
"advanced_tests_failed": "Advanced tests: Failed",
"simple_tests_ok": "File structure tests: OK",
"advanced_tests_ok": "Advanced tests: OK"
"advanced_tests_ok": "Advanced tests: OK",
"download_artifacts": "Download artifacts",
"artifacts": "Artifacts"
}
6 changes: 4 additions & 2 deletions frontend/locales/nl/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"view_co_teachers": "Bekijk mede-docenten",
"view_students": "Bekijk studenten",
"visibility": "Zichtbaarheid",
"download_file": "Download",
"download_file": "Download bestanden",
"denied": "Geweigerd",
"show_more": "Toon meer",
"show_less": "Toon minder",
Expand Down Expand Up @@ -163,5 +163,7 @@
"simple_tests_failed": "Bestandsstructuur tests: Gefaald",
"advanced_tests_failed": "Geadvanceerde tests: Gefaald",
"simple_tests_ok": "Bestandsstructuur: OK",
"advanced_tests_ok": "Geadvanceerde tests: OK"
"advanced_tests_ok": "Geadvanceerde tests: OK",
"download_artifacts": "Download artefacten",
"artifacts": "Artefacten"
}

0 comments on commit 65603b6

Please sign in to comment.