Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Eenvoudige bestandsstructuur: mappen en bestanden worden verkeerd geplaatst. #366

Merged
merged 2 commits into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions frontend/src/components/SimpleTests/SimpleTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,18 @@ export default function SimpleTests(props: {
// check local
const oldConstraint = local_constraints_plus_zip.find(constraint => constraint.id === id);
const newConstraint = new Constraint(type, "CHANGE_ME", newId, id, oldConstraint!.depth+1);
const sub_items = zip.local_constraints.filter(constraint => constraint.parent_id === id);

const sub_item_ids = [id]; // get subitems recursively
const sub_items: Constraint[] = [];
for (const try_sub_constraint of zip.local_constraints) {
if (try_sub_constraint.parent_id !== undefined) {
if (sub_item_ids.includes(try_sub_constraint.parent_id)) {
sub_item_ids.push(try_sub_constraint.id);
sub_items.push(try_sub_constraint);
}
}
}

let index!: number;
if (sub_items.length === 0) {
// No sub-items yet. Put directly after item.
Expand Down Expand Up @@ -640,9 +651,9 @@ export default function SimpleTests(props: {
contentStyle={{width: 'auto'}}
>
<div>
<button className="menu-not-last-item" onClick={() => handleNewConstraint(undefined, 'NOT_PRESENT')}>{t('submission_files.menu.not_present')}</button>
<button className="menu-not-last-item" onClick={() => handleNewConstraint(undefined, 'EXTENSION_NOT_PRESENT')}>{t('submission_files.menu.extension_not_present')}</button>
<button onClick={() => handleNewConstraint(undefined, 'EXTENSION_ONLY_PRESENT')}>{t('submission_files.menu.extension_only_present')}</button>
<button className="menu-not-last-item" onClick={() => handleNewConstraint(undefined, 'NOT_PRESENT')}>{t('submission_files.menu.not_present').match(/'(.*?)'/)?.[1]}</button>
<button className="menu-not-last-item" onClick={() => handleNewConstraint(undefined, 'EXTENSION_NOT_PRESENT')}>{t('submission_files.menu.extension_not_present').match(/'(.*?)'/)?.[1]}</button>
<button onClick={() => handleNewConstraint(undefined, 'EXTENSION_ONLY_PRESENT')}>{t('submission_files.menu.extension_only_present').match(/'(.*?)'/)?.[1]}</button>
</div>
</Popup>
}
Expand Down