- {submission?.output_test !== "" ? (
+ {submission?.output_simple_test ? (
) : (
)}
- {submission?.output_test !== "" ? t("accepted") : t("denied")}
+ {submission?.output_simple_test ? t("accepted") : t("denied")}
{`(${t("timestamp")}: ${formatDate(submission?.timestamp)})`}
@@ -113,6 +113,40 @@ const SubmissionDetailsPage: React.FC = ({ locale, s
+ {
+ !submission?.output_simple_test ? (
+ <>
+
+
+ {submission?.feedback_simple_test["0"].length > 0 ? (
+ <>
+
+ {t("feedback_simple_test_0")}
+
+ {submission?.feedback_simple_test["0"].map((feedback, index) => (
+
+ {feedback}
+
+ ))}
+ >
+ ) : null}
+
+ {submission?.feedback_simple_test["2"].length > 0 ? (
+ <>
+
+ {t("feedback_simple_test_2")}
+
+ {submission?.feedback_simple_test["2"].map((feedback, index) => (
+
+ {feedback}
+
+ ))}
+ >
+ ) : null}
+ >
+ ) : null
+ }
+
diff --git a/frontend/app/[locale]/components/SubmitDetailsPage.tsx b/frontend/app/[locale]/components/SubmitDetailsPage.tsx
index 33e213f1..9f159f29 100644
--- a/frontend/app/[locale]/components/SubmitDetailsPage.tsx
+++ b/frontend/app/[locale]/components/SubmitDetailsPage.tsx
@@ -57,7 +57,9 @@ const SubmitDetailsPage: React.FC = ({
};
const handleSubmit = async (e) => {
- setSubmitted(await uploadSubmissionFile(e, project_id));
+ const response = await uploadSubmissionFile(e, project_id);
+ setSubmitted(response);
+ window.location.href = `/submission/${response.submission_id}/`;
};
useEffect(() => {
diff --git a/frontend/lib/api.ts b/frontend/lib/api.ts
index 37cafd91..dd74a828 100644
--- a/frontend/lib/api.ts
+++ b/frontend/lib/api.ts
@@ -78,7 +78,8 @@ export type Submission = {
submission_nr: number;
file: string;
timestamp: string;
- output_test: string;
+ output_simple_test: boolean;
+ feedback_simple_test: object;
}
export type UserData = {
@@ -681,13 +682,14 @@ export async function joinCourseUsingToken(course_id: number, token: string) {
type uploadResult = {
result: string;
errorcode: string | undefined;
+ submission_id: number;
}
export async function uploadSubmissionFile(event: any, project_id: string) : Promise{
axios.defaults.headers.get['X-CSRFToken'] = getCookieValue('csrftoken');
axios.defaults.headers.post['X-CSRFToken'] = getCookieValue('csrftoken');
event.preventDefault();
- console.log(event.target.fileList.files);
+
const formData = new FormData(event.target);
//filter files by key
@@ -710,13 +712,13 @@ export async function uploadSubmissionFile(event: any, project_id: string) : Pro
let groupres = await axios.get(backend_url + "/projects/" + project_id + "/get_group/", {withCredentials: true});
const group_id = groupres.data.group_id;
formDataObject.group_id = group_id;
- await axios.post(backend_url + '/submissions/', formDataObject,
+ const response = await axios.post(backend_url + '/submissions/', formDataObject,
{ withCredentials: true,
headers: {
'Content-Type': 'multipart/form-data'
}
});
- return {result: "ok", errorcode: undefined};
+ return {result: "ok", errorcode: undefined, submission_id: response.data.submission_id};
} catch (error) {
const apierror : APIError = new APIError();
apierror.message = "error posting form";
diff --git a/frontend/locales/en/common.json b/frontend/locales/en/common.json
index 0b4cc7ec..623fa825 100644
--- a/frontend/locales/en/common.json
+++ b/frontend/locales/en/common.json
@@ -1,5 +1,5 @@
{
- "accepted": "accepted",
+ "accepted": "Accepted",
"description_of_your_course": "Description of your course",
"access": "Access",
"action_dialog": "This action cannot be undone.",
@@ -101,7 +101,6 @@
"visibility": "Visibility",
"year": "Year",
"archive_course": "Archive course",
- "visibility": "Visibility",
"download_file": "Download",
"denied": "Denied",
"show_more": "Show more",
@@ -152,5 +151,7 @@
"teachers": "Teachers",
"courses_archive": "Courses archive",
"courses_all": "All courses",
- "open": "Open"
+ "open": "Open",
+ "feedback_simple_test_0": "You forgot to upload the following files:",
+ "feedback_simple_test_2": "You uploaded the following files that were not required:"
}
\ No newline at end of file
diff --git a/frontend/locales/nl/common.json b/frontend/locales/nl/common.json
index ed74d721..1e894b03 100644
--- a/frontend/locales/nl/common.json
+++ b/frontend/locales/nl/common.json
@@ -1,5 +1,5 @@
{
- "accepted": "aanvaard",
+ "accepted": "Aanvaard",
"description_of_your_course": "Beschrijving van je cursus",
"access": "Toegang",
"action_dialog": "Deze actie kan niet ongedaan worden gemaakt.",
@@ -149,6 +149,8 @@
"project_calendar": "Project kalender",
"edit_user_details": "Gebruiker bewerken",
"status_button_tooltip": "Verplicht, optioneel of verboden bestand",
+ "feedback_simple_test_0": "Je hebt de volgende bestanden niet ingeleverd:",
+ "feedback_simple_test_2": "Je hebt de volgende bestanden ingeleverd die niet nodig zijn:",
"no_deadline": "Geen deadline",
"all_submissions": "Alle indieningen",
"students": "Studenten",
diff --git a/scripts/opdracht_enkel_verboden/extra/verslag.pdf b/scripts/opdracht_enkel_verboden/extra/verslag.pdf
new file mode 100644
index 00000000..e69de29b
diff --git a/scripts/opdracht_enkel_verboden/src/main.py b/scripts/opdracht_enkel_verboden/src/main.py
new file mode 100644
index 00000000..e69de29b
diff --git a/scripts/opdracht_enkel_verboden/tests/test.test b/scripts/opdracht_enkel_verboden/tests/test.test
new file mode 100644
index 00000000..e69de29b
diff --git a/scripts/opdracht_incorrect/tests/test.test b/scripts/opdracht_incorrect/tests/test.test
new file mode 100644
index 00000000..73d1dd37
--- /dev/null
+++ b/scripts/opdracht_incorrect/tests/test.test
@@ -0,0 +1 @@
+dit bestand is verboden