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

Commit

Permalink
Merge pull request #366 from SELab-2/bugfix
Browse files Browse the repository at this point in the history
Eenvoudige bestandsstructuur: mappen en bestanden worden verkeerd geplaatst.
  • Loading branch information
lbarraga authored May 23, 2024
2 parents d49e3db + 6844293 commit 6c9d184
Showing 1 changed file with 15 additions and 4 deletions.
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

0 comments on commit 6c9d184

Please sign in to comment.