Skip to content

Commit 9402162

Browse files
committed
fixed sources stuff
1 parent ed88ad9 commit 9402162

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

schemas/+sln_animal/add_source.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
try
1919
%source_id = add_source_if_missing(...)
2020
insert(sln_animal.Source,key_s);
21-
source_id(i) = fetch1(sln_animal.Source, 'source_id', 'LIMIT 1 DESC');
21+
source_id(i) = fetch1(sln_animal.Source, 'source_id', 'ORDER BY source_id DESC LIMIT 1');
2222
key.source_id = source_id(i);
2323
insert(feval(sprintf('sln_animal.%s',source_type)), key);
2424
C.commitTransaction;
25-
catch
25+
catch ME
2626
C.cancelTransaction;
27+
rethrow(ME)
2728
end
2829
end
2930
end

schemas/+sln_animal/init_animals.m

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,10 @@
6363
curSourceID = old_animals(curInd).source_id;
6464

6565
if ismember(curSourceID, all_breeding_cages)
66-
b = sl.BreedingCage & sprintf('cage_number="%s"', curSourceID)
67-
b.getMember('Male')
68-
pause;
66+
b = sl.BreedingCage & sprintf('cage_number="%s"', curSourceID);
6967
try
70-
71-
key.male_id = fetch1(b.getMember('Male'), 'animal_id')
72-
key.female_id = fetch1(b.getMember('Female'), 'animal_id')
68+
key.male_id = fetch1(b.getMember('Male'), 'animal_id');
69+
key.female_id = fetch1(b.getMember('Female'), 'animal_id');
7370
id = sln_animal.add_source(key,'BreedingPair');
7471
active_breeding_cage_ind = [active_breeding_cage_ind, curInd];
7572
new_animals(curInd).source_id = id;

0 commit comments

Comments
 (0)