Skip to content

Commit

Permalink
Bugfix: Database update would create 'Unnamed subjects'
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Cousineau committed May 22, 2019
1 parent f424153 commit 8a076e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions toolbox/core/bst_startup.m
Expand Up @@ -170,7 +170,7 @@ function bst_startup(BrainstormHomeDir, GuiLevel, BrainstormDbDir)
% Get user database file : brainstorm.mat
dbFile = bst_get('BrainstormDbFile');
% Current DB version
CurrentDbVersion = 5;
CurrentDbVersion = 5.01;
% Get default colormaps list
sDefColormaps = bst_colormaps('Initialize');
isDbLoaded = 0;
Expand Down Expand Up @@ -249,7 +249,8 @@ function bst_startup(BrainstormHomeDir, GuiLevel, BrainstormDbDir)
end
% Check database structure for updates
db_update(CurrentDbVersion);
else
end
if GlobalData.DataBase.DbVersion == 0
% Database version is not defined, so it up-to-date
GlobalData.DataBase.DbVersion = CurrentDbVersion;
end
Expand Down
6 changes: 3 additions & 3 deletions toolbox/db/db_update.m
Expand Up @@ -326,16 +326,16 @@ function db_update(LatestDbVersion, sProtocol, saveMetadata)
bst_set('ProcessOptions', []);
end

%% ===== UPDATE 07-May-2019 =====
%% ===== UPDATE 07-May-2019 AND 22-May-2019 =====
% Modification: add fibers objects
if (CurrentDbVersion < 5)
if (CurrentDbVersion < 5.01)
disp('BST> Database update: Adding support for diffusion fibers...');
for iProt = 1:length(ProtocolsListSubjects)
subjFields = fieldnames(ProtocolsListSubjects(iProt));
for iField = 1:length(subjFields)
subjField = subjFields{iField};
nSubjects = length(ProtocolsListSubjects(iProt).(subjField));
sSubjects = repmat(db_template('subject'), nSubjects);
sSubjects = repmat(db_template('subject'), 1, nSubjects);
for iSubj = 1:nSubjects
% Add iFibers to subject
sSubjects(iSubj) = struct_copy_fields(db_template('subject'), ProtocolsListSubjects(iProt).(subjField)(iSubj));
Expand Down

0 comments on commit 8a076e9

Please sign in to comment.