Skip to content

Commit

Permalink
Update GuidedPathExpansion.js
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettmflynn committed Mar 13, 2024
1 parent ad05e00 commit 0150e97
Showing 1 changed file with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,28 +339,26 @@ export class GuidedPathExpansionPage extends Page {

const globalResults = globalState.results;

if (!keepExistingData) {
for (let sub in globalResults) {
const subRef = results[sub];
if (!subRef)
delete globalResults[sub]; // Delete removed subjects
else {
for (let ses in globalResults[sub]) {
const sesRef = subRef[ses];

if (!sesRef)
delete globalResults[sub][ses]; // Delete removed sessions
else {
const globalSesRef = globalResults[sub][ses];

for (let name in globalSesRef.source_data) {
if (!sesRef.source_data[name]) delete globalSesRef.source_data[name]; // Delete removed interfaces
}
for (let sub in globalResults) {
const subRef = results[sub];
if (!subRef)
delete globalResults[sub]; // Delete removed subjects
else {
for (let ses in globalResults[sub]) {
const sesRef = subRef[ses];

if (!sesRef)
delete globalResults[sub][ses]; // Delete removed sessions
else {
const globalSesRef = globalResults[sub][ses];

for (let name in globalSesRef.source_data) {
if (!sesRef.source_data[name]) delete globalSesRef.source_data[name]; // Delete removed interfaces
}
}

if (Object.keys(globalResults[sub]).length === 0) delete globalResults[sub]; // Delete empty subjects
}

if (Object.keys(globalResults[sub]).length === 0) delete globalResults[sub]; // Delete empty subjects
}
}
};
Expand Down

0 comments on commit 0150e97

Please sign in to comment.