Replace "count > 0" with "any?"

This commit is contained in:
Patrick Gansterer 2016-03-04 17:39:06 +01:00
parent 97f81d9826
commit 1efd3745df
4 changed files with 7 additions and 7 deletions

View file

@ -10,14 +10,14 @@
%b= heading_helper(Invoice, :supplier) + ':'
= @invoice.supplier.name
- if @invoice.deliveries.count > 0
- if @invoice.deliveries.any?
%p
%b= heading_helper(Invoice, :deliveries) + ':'
%span><
- @invoice.deliveries.order(:delivered_on).each_with_index do |delivery, index|
= ', ' if index > 0
= link_to format_date(delivery.delivered_on), [delivery.supplier,delivery]
- if @invoice.orders.count > 0
- if @invoice.orders.any?
%p
%b= heading_helper(Invoice, :orders) + ':'
%span><

View file

@ -24,7 +24,7 @@
%td.right
= link_to t('.groups.invite'), new_invite_path(id: @current_user.ordergroup),
remote: true, class: 'btn btn-success btn-small'
- if @current_user.workgroups.count > 0
- if @current_user.workgroups.any?
%h3= User.human_attribute_name(:workgroup, count: 2)
%table.table.table-striped
- @current_user.workgroups.each do |workgroup|

View file

@ -2,7 +2,7 @@
- content_for :actionbar do
= link_to t('suppliers.index.articles', count: @supplier.articles.undeleted.count), supplier_articles_path(@supplier), class: 'btn'
- if @supplier.stock_articles.undeleted.count > 0
- if @supplier.stock_articles.undeleted.any?
= link_to t('suppliers.index.stock', count: @supplier.stock_articles.undeleted.count), stock_articles_path, class: 'btn'
.row-fluid
@ -44,7 +44,7 @@
= link_to t('ui.edit'), edit_supplier_path(@supplier), class: 'btn'
= link_to t('ui.delete'), @supplier, :data => {:confirm => t('.confirm_delete')}, :method => :delete, class: 'btn btn-danger'
- if @deliveries.count > 0
- if @deliveries.any?
.span6
.pull-right
= link_to t('.show_deliveries'), supplier_deliveries_path(@supplier), class: 'btn'
@ -61,7 +61,7 @@
%td= link_to delivery.delivered_on, [@supplier, delivery]
%td= link_to_invoice(delivery)
- if @orders.count > 0
- if @orders.any?
.span6
%h2= t '.last_orders'
%table.table.table-horizontal

View file

@ -1,5 +1,5 @@
-# XXX code duplication of foodcoop-adam's app/views/group_orders/show.html.haml
- if @articles_grouped_by_category.count > 0
- if @articles_grouped_by_category.any?
%table.table.table-hover
%thead
%tr