trello integration finished
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user