Skip to content

Commit

Permalink
Fix assay streams upgrade task
Browse files Browse the repository at this point in the history
  • Loading branch information
kdp-cloud committed Mar 5, 2024
1 parent a75ee56 commit b48860b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/tasks/seek_upgrades.rake
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ namespace :seek do
# Previous ST should be second ST of study
first_assays_in_stream = Assay.joins(:sample_type, study: :investigation)
.where(assay_stream_id: nil, investigation: { is_isa_json_compliant: true })
.select { |a| a.previous_linked_sample_type == a.study.sample_types.second }
.select { |a| a.sample_type.previous_linked_sample_type == a.study.sample_types.second }

first_assays_in_stream.map do |fas|
stream_name = "Assay Stream - #{UUID.generate}"
Expand All @@ -212,7 +212,11 @@ namespace :seek do
current_assay.update_column(:assay_stream_id, assay_stream.id)

assay_position += 1
current_assay = current_assay.next_linked_child_assay
current_assay = if current_assay.sample_type.nil?
nil
else
current_assay.sample_type.next_linked_sample_types.first&.assays&.first
end
end
assay_streams_created += 1
end
Expand Down

0 comments on commit b48860b

Please sign in to comment.