Skip to content

Commit

Permalink
Prevent duplicate options in 'Select Guidance'
Browse files Browse the repository at this point in the history
- Prior to this commit, if current_user.org was also a @default_org, then @important_ggs would contain duplicate [org, ggs].
  • Loading branch information
aaronskiba committed Apr 8, 2024
1 parent 7bef45f commit 2d69584
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/controllers/plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,8 @@ def show
end
@default_orgs = Org.default_orgs
@all_ggs_grouped_by_org.each do |org, ggs|
@important_ggs << [org, ggs] if @default_orgs.include?(org)

# If this is one of the already selected guidance groups its important!
@important_ggs << [org, ggs] if !(ggs & @selected_guidance_groups).empty? && !@important_ggs.include?([org, ggs])
# @default_orgs and already selected guidance groups are important.
@important_ggs << [org, ggs] if (@default_orgs.include?(org) || !(ggs & @selected_guidance_groups).empty?) && !@important_ggs.include?([org, ggs])
end

# Sort the rest by org name for the accordion
Expand Down

0 comments on commit 2d69584

Please # to comment.