Skip to content

Commit

Permalink
#100: Generate datasets per investigation
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranjprice101 committed Oct 23, 2019
1 parent 0478a45 commit 4d163b2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions util/icat_db_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def generate_study_investigation(i):

class DatasetGenerator(Generator):
tier = 4
amount = InvestigationGenerator.amount # One Dataset per investigation
amount = InvestigationGenerator.amount * 2 # Two Datasets per investigation

def generate(self):
self.pool_map(DatasetGenerator.generate_dataset)
Expand All @@ -533,8 +533,10 @@ def generate_dataset(i):
apply_common_attributes(dataset, i)
dataset.COMPLETE = randrange(2)
dataset.LOCATION = faker.file_path()
dataset.INVESTIGATION_ID = i
dataset.SAMPLE_ID = i
investigation_id = i % InvestigationGenerator.amount
dataset.INVESTIGATION_ID = investigation_id if investigation_id != 0 else InvestigationGenerator.amount - 1
sample_id = i % SampleGenerator.amount
dataset.SAMPLE_ID = sample_id if sample_id != 0 else SampleGenerator.amount - 1
dataset.TYPE_ID = randrange(1, DatasetTypeGenerator.amount)
post_entity(dataset)

Expand Down

0 comments on commit 4d163b2

Please sign in to comment.