Skip to content

Commit

Permalink
Add rake upgrade task for recognising ISA JSON compliant investigations
Browse files Browse the repository at this point in the history
  • Loading branch information
kdp-cloud committed Jan 10, 2024
1 parent 686a849 commit a562a73
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/tasks/seek_upgrades.rake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace :seek do
rename_registered_sample_multiple_attribute_type
remove_ontology_attribute_type
db:seed:007_sample_attribute_types
recognise_isa_json_compliant_items
]

# these are the tasks that are executes for each upgrade as standard, and rarely change
Expand Down Expand Up @@ -156,6 +157,21 @@ namespace :seek do
puts " ... finished updating sample_resource_links of #{samples_updated.to_s} samples with data_file attributes"
end

task(recognise_isa_json_compliant_items: [:environment]) do
puts '... searching for ISA compliant investigations'
investigations_updated = 0
disable_authorization_checks do
isa_json_compliant_studies = Study.all.select { |study| study.sample_types.any? }
isa_json_compliant_studies.each do |study|
inv = study.investigation
inv.update(is_isa_json_compliant: true)
inv.save
investigations_updated += 1
end
end
puts "...Updated #{investigations_updated} investigations"
end

private

##
Expand Down

0 comments on commit a562a73

Please sign in to comment.