Skip to content

Commit

Permalink
Fixed bug with seeding data exports to database due to hardcoded year…
Browse files Browse the repository at this point in the history
…s for sample names (#881)
  • Loading branch information
deepsidhu85 authored Jan 7, 2025
1 parent 08505f0 commit 4eeb234
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,38 +204,40 @@ def seed_workflow_executions # rubocop:disable Metrics/MethodLength, Metrics/Abc
end

def seed_exports # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
current_year = Time.zone.now.year

export_params = [
{
user: User.find_by(email: '[email protected]'),
sample: Sample.find_by(name: 'Bacillus anthracis/Outbreak 2022 Sample 10')
sample: Sample.find_by(name: "Bacillus anthracis/Outbreak #{current_year - 2} Sample 10")
},
{
user: User.find_by(email: '[email protected]'),
sample: Sample.find_by(name: 'Bartonella henselae/Outbreak 2022 Sample 10')
sample: Sample.find_by(name: "Bartonella henselae/Outbreak #{current_year - 2} Sample 10")
},
{
user: User.find_by(email: '[email protected]'),
sample: Sample.find_by(name: 'Bordetella pertussis/Outbreak 2022 Sample 10')
sample: Sample.find_by(name: "Bordetella pertussis/Outbreak #{current_year - 2} Sample 10")
},
{
user: User.find_by(email: '[email protected]'),
sample: Sample.find_by(name: 'Borrelia burgdorferi/Outbreak 2022 Sample 10')
sample: Sample.find_by(name: "Borrelia burgdorferi/Outbreak #{current_year - 2} Sample 10")
},
{
user: User.find_by(email: '[email protected]'),
sample: Sample.find_by(name: 'Brucella abortus/Outbreak 2022 Sample 10')
sample: Sample.find_by(name: "Brucella abortus/Outbreak #{current_year - 2} Sample 10")
},
{
user: User.find_by(email: '[email protected]'),
sample: Sample.find_by(name: 'Campylobacter jejuni/Outbreak 2022 Sample 10')
sample: Sample.find_by(name: "Campylobacter jejuni/Outbreak #{current_year - 2} Sample 10")
},
{
user: User.find_by(email: '[email protected]'),
sample: Sample.find_by(name: 'Yersinia pestis/Outbreak 2022 Sample 10')
sample: Sample.find_by(name: "Yersinia pestis/Outbreak #{current_year - 2} Sample 10")
},
{
user: User.find_by(email: '[email protected]'),
sample: Sample.find_by(name: 'Vibrio cholerae/Outbreak 2023 Sample 10')
sample: Sample.find_by(name: "Vibrio cholerae/Outbreak #{current_year - 1} Sample 10")
}
]
export_params.each_with_index do |export_param, index| # rubocop:disable Metrics/BlockLength
Expand Down

0 comments on commit 4eeb234

Please sign in to comment.