Skip to content

Commit

Permalink
fix bug of default users when prespecified
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Mar 24, 2022
1 parent 1d656b6 commit 627ceef
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ui/createQuestionnaire.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

cfg = askForGroupAndOrSession(cfg);

items = returnDefaultQuestionnaire(cfg);
[items, cfg] = returnDefaultQuestionnaire(cfg);

% check pre filled answers
fields = {'subjectGrp', 'subjectNb', 'sessionNb', 'runNb'};
Expand Down
5 changes: 5 additions & 0 deletions src/ui/returnDefaultQuestionnaire.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
items(3).response = 666;
items(4).response = 666;

cfg.subject.subjectGrp = items(1).response;
cfg.subject.subjectNb = items(2).response;
cfg.subject.sessionNb = items(3).response;
cfg.subject.runNb = items(4).response;

end

end
20 changes: 20 additions & 0 deletions tests/test_userInputs.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@
initTestSuite;
end

function test_userInputs_prefilled_cfg_ignored_by_debug()

%%
cfg.debug.do = true;
cfg.subject.subjectGrp = 'foo';
cfg.subject.subjectNb = 2;
cfg.subject.sessionNb = 2;
cfg.subject.runNb = 2;

cfg = checkCFG(cfg);

cfg = userInputs(cfg);

assertEqual(cfg.subject.subjectGrp, 'ctrl');
assertEqual(cfg.subject.subjectNb, 666);
assertEqual(cfg.subject.sessionNb, 666);
assertEqual(cfg.subject.runNb, 666);

end

function test_userInputs_prefilled_cfg_cli()

%%
Expand Down

0 comments on commit 627ceef

Please sign in to comment.