|
@@ -35,10 +35,19 @@ def detail_service(request, pk):
|
|
|
(i.cost_share() for i in costs_uses),
|
|
|
))
|
|
|
|
|
|
+ total_goods_value_share = sum(i.value_share() for i in goods_uses)
|
|
|
+
|
|
|
if service.subscriptions_count == 0:
|
|
|
unit_costs_price = 0
|
|
|
+ unit_goods_value_share = 0
|
|
|
else:
|
|
|
unit_costs_price = total_costs_price/service.subscriptions_count
|
|
|
+ unit_goods_value_share = total_goods_value_share/service.subscriptions_count
|
|
|
+
|
|
|
+ if unit_costs_price > 0:
|
|
|
+ months_fas_equivalent = unit_goods_value_share/unit_costs_price
|
|
|
+ else:
|
|
|
+ months_fas_equivalent = 0
|
|
|
|
|
|
context = {
|
|
|
'service': service,
|
|
@@ -46,5 +55,9 @@ def detail_service(request, pk):
|
|
|
'goods_uses': goods_uses,
|
|
|
'total_costs_price': total_costs_price,
|
|
|
'unit_costs_price': unit_costs_price,
|
|
|
+
|
|
|
+ 'total_goods_value_share': total_goods_value_share,
|
|
|
+ 'unit_goods_value_share': unit_goods_value_share,
|
|
|
+ 'months_fas_equivalent': months_fas_equivalent,
|
|
|
}
|
|
|
return render(request, 'costs/service_detail.html', context)
|