Skip to content

Commit

Permalink
Use '.count' directly when the set is available
Browse files Browse the repository at this point in the history
  • Loading branch information
ncounter committed Mar 23, 2024
1 parent f12bcab commit 62a1f76
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/api/app/views/webui/request/_actions_details.html.haml
Expand Up @@ -2,7 +2,7 @@
:ruby
page_name ||= ''

- if actions_count > 1
- if actions.count > 1
.d-flex.flex-wrap.align-items-center
.input-group.w-auto
= link_to('Previous', next_prev_path(number: bs_request.number, request_action_id: prev_action&.id,
Expand Down Expand Up @@ -34,10 +34,10 @@
id: 'next-action-button')

- action_index = actions.find_index(action) + 1
%span.ms-2 Showing ##{action_index} (of #{actions_count})
%span.ms-2 Showing ##{action_index} (of #{actions.count})
%h5.mt-4
Action details
- if actions_count > 1 && User.session
- if actions.count > 1 && User.session
%span#action-seen-by-user-wrapper
= render ActionSeenByUserComponent.new(action: action, user: User.session!)

Expand Down
3 changes: 1 addition & 2 deletions src/api/app/views/webui/request/_request_header.html.haml
Expand Up @@ -75,6 +75,5 @@
-# action description, prev + dropdown select + next
= render partial: 'actions_details', locals: { bs_request: bs_request, action: action,
prev_action: prev_action, next_action: next_action,
actions: actions, actions_count: actions.count,
diff_to_superseded_id: diff_to_superseded_id,
actions: actions, diff_to_superseded_id: diff_to_superseded_id,
page_name: page_name }

0 comments on commit 62a1f76

Please sign in to comment.