Skip to content

Commit

Permalink
error message when creating an ordergroup with members in another ord…
Browse files Browse the repository at this point in the history
…ergroup
  • Loading branch information
aban1 committed Apr 11, 2023
1 parent 591097f commit 8337515
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 3 deletions.
1 change: 0 additions & 1 deletion app/controllers/tasks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def workgroup
if @group.is_a? Ordergroup
redirect_to tasks_url, :alert => I18n.t('tasks.error_not_found')
end

end

private
Expand Down
2 changes: 0 additions & 2 deletions app/models/ordergroup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class Ordergroup < Group
validates_numericality_of :account_balance, :message => I18n.t('ordergroups.model.invalid_balance')
validate :uniqueness_of_name, :uniqueness_of_members


after_create :update_stats!

scope :active, -> { joins(:orders).where(orders: { starts: (Time.now.months_ago(3)..Time.now) }).group(:id) }
Expand Down Expand Up @@ -175,7 +174,6 @@ def self.sort_by_param(param)
private

# Make sure, that a user can only be in one ordergroup
#this does not work for adding a second order group
def uniqueness_of_members
users.each do |user|
errors.add :user_tokens, I18n.t('ordergroups.model.error_single_group', :user => user.display) if user.groups.where(:type => 'Ordergroup').size >= 1
Expand Down

0 comments on commit 8337515

Please sign in to comment.