Skip to content

Commit

Permalink
Fix indexing of the problems of a staging project
Browse files Browse the repository at this point in the history
* Don't render collapsible links when there are no additional problems.
* Fix offset in index usage of problems. Array index starts with 0 in Ruby.

Co-authored-by: Dany Marcoux <dmarcoux@suse.com>
  • Loading branch information
bgeuken and Dany Marcoux committed Nov 16, 2018
1 parent fbadfa5 commit 7f590da
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
%i.fas.fa-check-circle.fa-2x.text-success
- else
%ul.list-group.list-group-flush
= render partial: 'problems_item', locals: { project: project, index: 1..(max_problems - 1) }

%span.collapse{ 'id': item_project_class }
= render partial: 'problems_item', locals: { project: project, index: max_problems..-1 }
= render partial: 'problems_item', locals: { project: project, index: 0...max_problems }

- length = project.problems.length
- if project.problems.length > max_problems
- if length > max_problems
%span.collapse{ 'id': item_project_class }
= render partial: 'problems_item', locals: { project: project, index: max_problems..-1 }

- number = length - max_problems
%li.list-group-item.table-list-group-item
%a.collapse-link{ 'data-toggle': 'collapse', href: "##{item_project_class}", 'aria-expanded': 'false' }
Expand Down

0 comments on commit 7f590da

Please sign in to comment.