fix order bug
This commit is contained in:
parent
3953c21ae2
commit
3a41e9530f
5 changed files with 6 additions and 6 deletions
|
@ -13,7 +13,7 @@ class GroupOrderArticle < ActiveRecord::Base
|
|||
validates_inclusion_of :tolerance, :in => 0..99
|
||||
validates_uniqueness_of :order_article_id, :scope => :group_order_id # just once an article per group order
|
||||
|
||||
scope :ordered, -> { includes(:group_order => :ordergroup).order(:groups => :name) }
|
||||
scope :ordered, -> { includes(:group_order => :ordergroup).order('groups.name') }
|
||||
|
||||
localize_input_of :result
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class Order < ActiveRecord::Base
|
|||
# make sure to include those articles which are no longer available
|
||||
# but which have already been ordered in this stock order
|
||||
StockArticle.available.includes(:article_category).
|
||||
order('article_categories.name, articles.name').reject{ |a|
|
||||
order('article_categories.name', 'articles.name').reject{ |a|
|
||||
a.quantity_available <= 0 and not a.ordered_in_order?(self)
|
||||
}.group_by { |a| a.article_category.name }
|
||||
else
|
||||
|
|
|
@ -65,9 +65,9 @@ class User < ActiveRecord::Base
|
|||
def self.natural_order
|
||||
# would be sensible to match ApplicationController#show_user
|
||||
if FoodsoftConfig[:use_nick]
|
||||
order('nick ASC')
|
||||
order('nick')
|
||||
else
|
||||
order('first_name ASC, last_name ASC')
|
||||
order('first_name', 'last_name')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ class Workgroup < Group
|
|||
|
||||
has_many :tasks
|
||||
# returns all non-finished tasks
|
||||
has_many :open_tasks, -> { where(:done => false).order('due_date ASC, name ASC') }, :class_name => 'Task'
|
||||
has_many :open_tasks, -> { where(:done => false).order('due_date', 'name') }, :class_name => 'Task'
|
||||
|
||||
validates_uniqueness_of :name
|
||||
validate :last_admin_on_earth, :on => :update
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#recipients
|
||||
= f.input :recipient_tokens, :input_html => { 'data-pre' => User.where(id: @message.recipients_ids).map(&:token_attributes).to_json }
|
||||
= f.input :group_id, :as => :select, :collection => Group.undeleted.order('type DESC, name ASC').reject { |g| g.memberships.empty? }
|
||||
= f.input :group_id, :as => :select, :collection => Group.undeleted.order('type DESC', 'name ASC').reject { |g| g.memberships.empty? }
|
||||
= f.input :private
|
||||
= f.input :subject, input_html: {class: 'input-xxlarge'}
|
||||
= f.input :body, input_html: {class: 'input-xxlarge'}
|
||||
|
|
Loading…
Reference in a new issue