Merge pull request #7546 from aignatov-bio/ai-sci-10675-update-results-counter-logic

Update results counter logic [SCI-10675]
This commit is contained in:
aignatov-bio 2024-05-10 13:43:13 +02:00 committed by GitHub
commit a87347cde6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View file

@ -155,6 +155,14 @@ class MyModule < ApplicationRecord
experiment
end
def results_count(view_mode = 'active')
return results.size if archived_branch?
return results.archived.size if view_mode == 'archived'
results.active.size
end
def navigable?
!experiment.archived? && experiment.navigable?
end

View file

@ -14,7 +14,7 @@
data-e2e="e2e-BT-taskTabs-results"
>
<%= t("nav2.modules.results") %>
<%= "[#{(@my_module.archived_branch? ? @my_module.results : @my_module.results.active).size}]" %>
<%= "[#{@my_module.results_count(params[:view_mode])}]" %>
</a>
<a class="p-3 border-b-4 border-transparent hover:no-underline uppercase text-bold capitalize <%= is_module_activities? ? "text-sn-blue" : "text-sn-grey" %>"
href="<%= activities_my_module_url(@my_module, view_mode: params[:view_mode]) %>"