give partially unused order articles a distinct colour

This commit is contained in:
wvengen 2014-06-04 10:05:18 +02:00
parent fee0cfbdc7
commit 2bf13dbefa
4 changed files with 15 additions and 4 deletions

View file

@ -184,10 +184,11 @@ class OrderArticle < ActiveRecord::Base
@update_global_price = (value == true or value == '1') ? true : false
end
# Units missing for the next full unit_quantity of the article
# @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 = 0 if units < 0
units = 0 if units == article.unit_quantity
units
end