Merge pull request #408 from foodcoop1040/count_to_any

Replace "count > 0" with "any?"
This commit is contained in:
wvengen 2016-03-04 21:37:21 +01:00
commit f5b6fbcf18
4 changed files with 7 additions and 7 deletions

View file

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

View file

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

View file

@ -2,7 +2,7 @@
- content_for :actionbar do - content_for :actionbar do
= link_to t('suppliers.index.articles', count: @supplier.articles.undeleted.count), supplier_articles_path(@supplier), class: 'btn' = 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' = link_to t('suppliers.index.stock', count: @supplier.stock_articles.undeleted.count), stock_articles_path, class: 'btn'
.row-fluid .row-fluid
@ -44,7 +44,7 @@
= link_to t('ui.edit'), edit_supplier_path(@supplier), class: 'btn' = 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' = 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 .span6
.pull-right .pull-right
= link_to t('.show_deliveries'), supplier_deliveries_path(@supplier), class: 'btn' = 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 delivery.delivered_on, [@supplier, delivery]
%td= link_to_invoice(delivery) %td= link_to_invoice(delivery)
- if @orders.count > 0 - if @orders.any?
.span6 .span6
%h2= t '.last_orders' %h2= t '.last_orders'
%table.table.table-horizontal %table.table.table-horizontal

View file

@ -1,5 +1,5 @@
-# XXX code duplication of foodcoop-adam's app/views/group_orders/show.html.haml -# 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 %table.table.table-hover
%thead %thead
%tr %tr