trello integration finished

This commit is contained in:
Senad Uka
2015-09-26 11:58:01 +02:00
parent ae8e9b0081
commit 014416ca51
16 changed files with 867 additions and 81 deletions

View File

@@ -53,4 +53,30 @@ class Cart < ActiveRecord::Base
cart ||= Cart.where(anonymous_id_string: anonymous_id).where(ordered: false).first
return cart
end
def confirmed_at
delivery_destination.updated_at.in_time_zone('Europe/Sarajevo')
end
def delivery_cost
place = Place.by_code_or_default(delivery_destination.place)
if delivery_destination.instant_delivery
place.instant_delivery_price
else
place.delivery_price
end
end
def total
sum = item_in_carts.inject (0) { |sum, iic| sum + (iic.price * iic.count) }
sum += delivery_cost
end
def title
number = id
name = delivery_destination.name
value = Helper.money(total)
phone = "0#{delivery_destination.phone}"
"BR: #{number} za #{name} (#{phone}) - #{value}"
end
end