From ecf56010237572922a107f856bd88fff1d0f6228 Mon Sep 17 00:00:00 2001 From: wvengen Date: Mon, 1 Sep 2014 11:43:42 +0200 Subject: [PATCH] make missing_units get correct details for closed orders --- app/models/order_article.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/order_article.rb b/app/models/order_article.rb index f32f3f4e..a1eb19f4 100644 --- a/app/models/order_article.rb +++ b/app/models/order_article.rb @@ -186,9 +186,9 @@ class OrderArticle < ActiveRecord::Base # @return [Number] Units missing for the last +unit_quantity+ of the article. def missing_units - units = article.unit_quantity - ((quantity % article.unit_quantity) + tolerance) + units = price.unit_quantity - ((quantity % price.unit_quantity) + tolerance) units = 0 if units < 0 - units = 0 if units == article.unit_quantity + units = 0 if units == price.unit_quantity units end