handleDelete(index)}
- >
-
-
+
+
+ handleDelete(index)}
+ >
+
+
+
}
>
any[]) | any[])) => void,
+ file_status: any[],
+ setFileStatus: (value: (((prevState: any[]) => any[]) | any[])) => void,
}
function RequiredFiles(
- {files, setFiles}: RequiredFilesProps
+ {files, setFiles, file_status, setFileStatus}: RequiredFilesProps
) {
const {t} = useTranslation();
@@ -35,12 +37,14 @@ function RequiredFiles(
-
;
diff --git a/frontend/app/[locale]/project/[project_id]/edit/projectEditForm.tsx b/frontend/app/[locale]/project/[project_id]/edit/projectEditForm.tsx
index 79cd926a..3efaa934 100644
--- a/frontend/app/[locale]/project/[project_id]/edit/projectEditForm.tsx
+++ b/frontend/app/[locale]/project/[project_id]/edit/projectEditForm.tsx
@@ -33,6 +33,7 @@ interface ProjectEditFormProps {
function ProjectEditForm({project_id, add_course_id}: ProjectEditFormProps) {
const [files, setFiles] = useState([]);
+ const [status_files, setStatusFiles] = useState([]);
const [title, setTitle] = useState('');
const [description, setDescription] = useState('');
const [groupAmount, setGroupAmount] = useState(1);
@@ -70,8 +71,10 @@ function ProjectEditForm({project_id, add_course_id}: ProjectEditFormProps) {
setDescription(project.description)
if (project.file_structure !== null) {
const file_structure = project.file_structure.split(",").map((item: string) => item.trim().replace(/"/g, ''));
- setFiles(file_structure);
- console.log(files);
+ const file_structure_status = file_structure.map((item: string) => item[0]);
+ const file_structure_name = file_structure.map((item: string) => item.substring(1));
+ setFiles(file_structure_name);
+ setStatusFiles(file_structure_status);
}
setGroupSize(project["group_size"])
setTitle(project["name"])
@@ -115,7 +118,7 @@ function ProjectEditForm({project_id, add_course_id}: ProjectEditFormProps) {
async function setTestFiles(project: Project) {
const zip = new JSZip();
- console.log(project.test_files)
+
const test_files_zip = await getTestFiles(project.test_files);
const zipData = await zip.loadAsync(test_files_zip);
const testfiles_name: string[] = [];
@@ -152,13 +155,15 @@ function ProjectEditForm({project_id, add_course_id}: ProjectEditFormProps) {
const zipFileBlob = await zip.generateAsync({type: "blob"});
const formData = new FormData();
const zipFile = new File([zipFileBlob], "test_files.zip");
+
+ const required_files = files.map((item, index) => status_files[index] + item);
formData.append("test_files", zipFile);
formData.append("name", title);
formData.append("description", description);
formData.append("max_score", score.toString());
formData.append("number_of_groups", groupAmount.toString());
formData.append("group_size", groupSize.toString());
- formData.append("file_structure", files.join(","));
+ formData.append("file_structure", required_files.join(","));
formData.append("conditions", conditions.join(","));
formData.append("visible", visible.toString());
if (add_course_id < 0) {
@@ -233,7 +238,10 @@ function ProjectEditForm({project_id, add_course_id}: ProjectEditFormProps) {
description={description}/>
+ setFiles={setFiles}
+ file_status={status_files}
+ setFileStatus={setStatusFiles}
+ />
diff --git a/frontend/lib/api.ts b/frontend/lib/api.ts
index 92e61922..fe2f4c18 100644
--- a/frontend/lib/api.ts
+++ b/frontend/lib/api.ts
@@ -418,6 +418,11 @@ export async function getGroup(id: number): Promise {
return (await getRequest(`/groups/${id}`));
}
+export async function checkGroup(id: number) {
+ let response = await axios.get(backend_url + "/projects/" + id + "/get_group/", {withCredentials: true});
+ return response.status !== 404;
+}
+
export async function getGroups(): Promise {
return (await getListRequest('/groups'));
}
diff --git a/frontend/locales/en/common.json b/frontend/locales/en/common.json
index a556edd0..4730716c 100644
--- a/frontend/locales/en/common.json
+++ b/frontend/locales/en/common.json
@@ -135,5 +135,8 @@
"group_number": "Group number",
"submission_date": "Submission date",
"status": "Status",
- "join/leave": "Join/Leave"
+ "join/leave": "Join/Leave",
+ "group_nr": "Group nr",
+ "join_leave": "Join/Leave",
+ "not_in_group": "Join a group to submit"
}
\ No newline at end of file
diff --git a/frontend/locales/nl/common.json b/frontend/locales/nl/common.json
index 5bee265d..16a66b81 100644
--- a/frontend/locales/nl/common.json
+++ b/frontend/locales/nl/common.json
@@ -138,5 +138,8 @@
"group_number": "Groep nummer",
"submission_date": "Inleverdatum",
"status": "Status",
- "join/leave": "Toetreden/Verlaten"
+ "join/leave": "Toetreden/Verlaten",
+ "group_nr": "Groep nr",
+ "join_leave": "Toetreden/Verlaten",
+ "not_in_group": "Je kan niet indienen zonder in een groep te zitten"
}
\ No newline at end of file
diff --git a/scripts/opdracht_bestand_leeg/leeg b/scripts/opdracht_bestand_leeg/leeg
new file mode 100644
index 00000000..e69de29b