Skip to content

Commit

Permalink
handle the tree order
Browse files Browse the repository at this point in the history
  • Loading branch information
kf8a committed Jun 18, 2024
1 parent 973f0d7 commit 78fbc3d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/study.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def study_url(website)
end

def citation_treatments
treatments.by_use_in_citations
treatments.by_use_in_citations.with_tree_order
end

# check if there is more than one treatment associated with this study
Expand Down
1 change: 1 addition & 0 deletions app/models/treatment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Treatment < ApplicationRecord
has_and_belongs_to_many :citations

scope :by_use_in_citations, -> { where(use_in_citations: true) }
scope :with_tree_order, -> {order(:lft)}

def self.select_options
Treatment.all.map { |t| ["#{t.name} #{t.description}", t.id] }
Expand Down

0 comments on commit 78fbc3d

Please sign in to comment.