forked from jgrewe/fishbook
[frontend] add test flag to find methods
This commit is contained in:
parent
1832bae72c
commit
d968fdac8c
@ -251,7 +251,7 @@ class Dataset:
|
|||||||
total = len(dataset_list)
|
total = len(dataset_list)
|
||||||
if not test:
|
if not test:
|
||||||
for i, d in enumerate(dataset_list):
|
for i, d in enumerate(dataset_list):
|
||||||
progress(i+1, total, "fetching data")
|
progress(i+1, total, "fetching %i matches" % total)
|
||||||
results.append(Dataset(tuple=d))
|
results.append(Dataset(tuple=d))
|
||||||
return results, total
|
return results, total
|
||||||
|
|
||||||
@ -287,8 +287,8 @@ class Dataset:
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
str = "id: %s\n" % self.id
|
str = "id: %s\n" % self.id
|
||||||
str += "recorded: %s \t by:%s\n" % (self.recording_date, self.experimenter)
|
str += "recorded: %s \t by: %s\n" % (self.recording_date, self.experimenter)
|
||||||
str += "duration: %ss \t quality:%s\n" % (self.recording_duration, self.quality)
|
str += "duration: %ss \t quality: %s\n" % (self.recording_duration, self.quality)
|
||||||
str += "comment: %s" % self.comment
|
str += "comment: %s" % self.comment
|
||||||
return str
|
return str
|
||||||
|
|
||||||
@ -543,16 +543,17 @@ class Subject:
|
|||||||
return self.__tuple.copy()
|
return self.__tuple.copy()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def find(species=None):
|
def find(species=None, test=False):
|
||||||
subjs = Subjects & True
|
subjs = Subjects & True
|
||||||
if species:
|
if species:
|
||||||
subjs = (Subjects & "species like '%{0:s}%'".format(species))
|
subjs = (Subjects & "species like '%{0:s}%'".format(species))
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
total = len(subjs)
|
total = len(subjs)
|
||||||
for i, s in enumerate(subjs):
|
if not test:
|
||||||
results.append(Subject(tuple=s))
|
for i, s in enumerate(subjs):
|
||||||
progress(i+1, total, "fetching %i matches" % total)
|
results.append(Subject(tuple=s))
|
||||||
|
progress(i+1, total, "fetching %i matches" % total)
|
||||||
|
|
||||||
return results, total
|
return results, total
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user