cats_core 1.5.4 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6b9bb64c4119d94cb514bf76741d6160682cb7adfb376daf9aff38b14fccf77
|
4
|
+
data.tar.gz: 0c5b176315cfbd52ed72f3214831705bdd9a8e7fc524e2689517a3e1ff0d29cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3e0601550aebf25d5238ac8d9aabb57d933f3f48208bfe3a0cd39872a32e267dc97826c77eec6db841e40ae712ad4c7fded2ddb59b69da38f4ae874c5e4548b
|
7
|
+
data.tar.gz: '09ae2320e6fdfa2ec17b922068240768a0f614947b7de1ebbdc91fa412ecbd08e7b874593352e205975bb8647ddcf3e42959f51bdb14a9be335ef6a41d407376'
|
@@ -13,17 +13,18 @@ module Cats
|
|
13
13
|
rations = round_plan.round_rations
|
14
14
|
plan = round_plan.plan
|
15
15
|
no_of_days = plan.total_days / plan.rounds
|
16
|
+
mt = UnitOfMeasure.find_by(abbreviation: 'mt')
|
16
17
|
round_plan.beneficiary_round_plan_items.each do |plan_item|
|
17
18
|
round_rations = rations.select { |r| r.beneficiary_category_id == plan_item.beneficiary_category_id }
|
18
19
|
round_rations.each do |ration|
|
20
|
+
quantity = (no_of_days / ration.no_of_days * ration.quantity) * plan_item.beneficiaries *
|
21
|
+
round_plan.rounds.count
|
22
|
+
quantity = UnitConversion.convert(ration.unit, mt, quantity) if ration.unit.abbreviation.downcase != 'pcs'
|
23
|
+
|
19
24
|
details << {
|
20
25
|
beneficiary_round_plan_item_id: plan_item.id,
|
21
26
|
round_ration_id: ration.id,
|
22
|
-
quantity:
|
23
|
-
(no_of_days / ration.no_of_days * ration.quantity) *
|
24
|
-
plan_item.beneficiaries *
|
25
|
-
round_plan.rounds.count
|
26
|
-
)
|
27
|
+
quantity: quantity
|
27
28
|
}
|
28
29
|
end
|
29
30
|
end
|
data/lib/cats/core/version.rb
CHANGED