lib/mls/models/listing.rb in mls-0.9.2 vs lib/mls/models/listing.rb in mls-0.9.3
- old
+ new
@@ -153,11 +153,11 @@
end
# TODO: remove /desk/mo conversions
def rate(units='/sqft/mo')
- if rate_units == '/sqft/mo'
+ price = if rate_units == '/sqft/mo'
if units == '/sqft/mo'
@rate
elsif units == '/sqft/yr'
@rate * 12.0
elsif units == '/mo'
@@ -174,11 +174,11 @@
if units == '/sqft/mo'
@rate / 12.0
elsif units == '/sqft/yr'
@rate
elsif units == '/mo'
- (@rate / 12.0) * @size
+ (@rate * @size) / 12.0
elsif units == '/yr'
@rate * @size
elsif units == '/desk/mo'
(@rate / 12.0) * 200.0
else
@@ -229,9 +229,11 @@
else
raise "Invalid rate conversion (#{rate_units} => #{units})"
end
end
+
+ price.round(2)
end
# Creates a tour request for the listing.
#
# Paramaters::