Skip to content

Commit

Permalink
Increase visibility of the full tool list link - optimization aces#1409
Browse files Browse the repository at this point in the history
  • Loading branch information
MontrealSergiy committed Aug 12, 2024
1 parent d66b423 commit cf2872d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
21 changes: 8 additions & 13 deletions BrainPortal/app/controllers/portal_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,14 @@ def welcome #:nodoc:
@default_data_provider = DataProvider.find_by_id(current_user.meta["pref_data_provider_id"])
@default_bourreau = Bourreau.find_by_id(current_user.meta["pref_bourreau_id"])

@tools = Tool
.all
.order(:name)
.to_a
.reject { |t| t.category == 'background' }
.select { |t| t.tool_configs.to_a.any? { |tc|
tc.bourreau_id.present? &&
tc.bourreau_id > 0 &&
tc.version_name.present?
}
}

@avaiable_tools = @tools
@tool_count = Tool
.joins(:tool_configs)
.where.not(category: 'background')
.where('tool_configs.bourreau_id IS NOT NULL')
.where('tool_configs.bourreau_id > 0')
.where('tool_configs.version_name IS NOT NULL')
.distinct
.count

@dashboard_messages = Message
.where(:message_type => 'cbrain_dashboard')
Expand Down
2 changes: 1 addition & 1 deletion BrainPortal/app/views/portal/welcome.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
<strong>Your current time:</strong> <%= to_localtime(Time.now, :datetime) %><BR>
</p>
<p>
<strong>Tools available to you ( out of <%= link_to @tools.count , available_path %> ) :</strong><br/>
<strong>Tools available to you ( out of <%= link_to @tool_count , available_path %> ) :</strong><br/>
<%= array_to_table(current_user.available_tools.where( "category <> 'background'" ).to_a.map(&:name).sort, :table_class => 'simple', :cols => 4) %>
</p>
<p>
Expand Down

0 comments on commit cf2872d

Please sign in to comment.