Run rubocop --fix-layout and remove encoding comments
This commit is contained in:
parent
fa63e6e81d
commit
ea2862fdef
283 changed files with 1164 additions and 1969 deletions
|
|
@ -8,7 +8,6 @@ module Foodsoft
|
|||
# Please be thoughful when choosing names as to avoid collisions.
|
||||
# Do not put non-public info in variables.
|
||||
module ExpansionVariables
|
||||
|
||||
ACTIVE_MONTHS = 3
|
||||
|
||||
# @return [Hash] Variables and their values
|
||||
|
|
@ -16,31 +15,31 @@ module Foodsoft
|
|||
|
||||
# Hash of variables. Note that keys are Strings.
|
||||
@@variables = {
|
||||
'scope' => ->{ FoodsoftConfig.scope },
|
||||
'name' => ->{ FoodsoftConfig[:name] },
|
||||
'contact.street' => ->{ FoodsoftConfig[:contact][:street] },
|
||||
'contact.zip_code' => ->{ FoodsoftConfig[:contact][:zip_code] },
|
||||
'contact.city' => ->{ FoodsoftConfig[:contact][:city] },
|
||||
'contact.country' => ->{ FoodsoftConfig[:contact][:country] },
|
||||
'contact.email' => ->{ FoodsoftConfig[:contact][:email] },
|
||||
'contact.phone' => ->{ FoodsoftConfig[:contact][:phone] },
|
||||
'price_markup' => ->{ FoodsoftConfig[:price_markup] },
|
||||
'homepage' => ->{ FoodsoftConfig[:homepage] },
|
||||
'scope' => -> { FoodsoftConfig.scope },
|
||||
'name' => -> { FoodsoftConfig[:name] },
|
||||
'contact.street' => -> { FoodsoftConfig[:contact][:street] },
|
||||
'contact.zip_code' => -> { FoodsoftConfig[:contact][:zip_code] },
|
||||
'contact.city' => -> { FoodsoftConfig[:contact][:city] },
|
||||
'contact.country' => -> { FoodsoftConfig[:contact][:country] },
|
||||
'contact.email' => -> { FoodsoftConfig[:contact][:email] },
|
||||
'contact.phone' => -> { FoodsoftConfig[:contact][:phone] },
|
||||
'price_markup' => -> { FoodsoftConfig[:price_markup] },
|
||||
'homepage' => -> { FoodsoftConfig[:homepage] },
|
||||
|
||||
'help_url' => ->{ FoodsoftConfig[:help_url] },
|
||||
'applepear_url' => ->{ FoodsoftConfig[:applepear_url] },
|
||||
'help_url' => -> { FoodsoftConfig[:help_url] },
|
||||
'applepear_url' => -> { FoodsoftConfig[:applepear_url] },
|
||||
|
||||
'foodsoft.url' => ->{ FoodsoftConfig[:foodsoft_url] },
|
||||
'foodsoft.version' => Foodsoft::VERSION,
|
||||
'foodsoft.revision' => Foodsoft::REVISION,
|
||||
'foodsoft.url' => -> { FoodsoftConfig[:foodsoft_url] },
|
||||
'foodsoft.version' => Foodsoft::VERSION,
|
||||
'foodsoft.revision' => Foodsoft::REVISION,
|
||||
|
||||
'user_count' => ->{ User.undeleted.count },
|
||||
'ordergroup_count' => ->{ Ordergroup.undeleted.count },
|
||||
'active_ordergroup_count' => ->{ active_ordergroup_count },
|
||||
'supplier_count' => ->{ Supplier.undeleted.count },
|
||||
'active_supplier_count' => ->{ active_supplier_count },
|
||||
'active_suppliers' => ->{ active_suppliers },
|
||||
'first_order_date' => ->{ I18n.l Order.first.try{|o| o.starts.to_date} }
|
||||
'user_count' => -> { User.undeleted.count },
|
||||
'ordergroup_count' => -> { Ordergroup.undeleted.count },
|
||||
'active_ordergroup_count' => -> { active_ordergroup_count },
|
||||
'supplier_count' => -> { Supplier.undeleted.count },
|
||||
'active_supplier_count' => -> { active_supplier_count },
|
||||
'active_suppliers' => -> { active_suppliers },
|
||||
'first_order_date' => -> { I18n.l Order.first.try { |o| o.starts.to_date } }
|
||||
}
|
||||
|
||||
# Return expanded variable
|
||||
|
|
@ -60,7 +59,6 @@ module Foodsoft
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
# @return [Number] Number of ordergroups that have been active in the past 3 months
|
||||
def self.active_ordergroup_count
|
||||
GroupOrder
|
||||
|
|
@ -78,10 +76,9 @@ module Foodsoft
|
|||
# @return [String] Comma-separated list of suppliers that has been ordered from in the past 3 months
|
||||
def self.active_suppliers
|
||||
Supplier.joins(:orders)
|
||||
.where('orders.starts > ?', ACTIVE_MONTHS.months.ago)
|
||||
.order(:name).select(:name).distinct
|
||||
.map(&:name).join(', ')
|
||||
.where('orders.starts > ?', ACTIVE_MONTHS.months.ago)
|
||||
.order(:name).select(:name).distinct
|
||||
.map(&:name).join(', ')
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue