Add period unit support to domain price method #2741

This commit is contained in:
Martin Lensment 2015-07-02 17:49:40 +03:00
parent 98439b896c
commit 61dfe6e1f3
2 changed files with 26 additions and 1 deletions

View file

@ -374,7 +374,12 @@ class Domain < ActiveRecord::Base
def price(operation)
zone = name.split('.').drop(1).join('.')
p = "#{self.period}year"
p = period / 365 if period_unit == 'd'
p = period / 12 if period_unit == 'm'
p = period if period_unit == 'y'
p = "#{p}year"
Pricelist.price_for(zone, operation, p)
end