cats_core 1.5.4 → 1.5.6
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: 3cb500b5c99210b40ab7cd416cd861caf4cd61528515e5317ba1abc9690ab2a9
|
4
|
+
data.tar.gz: 4279dca09b00c065f1c4568c12baa404970ce8fa093d0eba4939e232eb849692
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e90c5c515b3fdd39a415dd6b174b0dddfac4775b067822aeec0dca3193125857fbc918cc46b04428a70badd5817353b2fd1eded643c387f66f1bbbbabc6014d3
|
7
|
+
data.tar.gz: 86ffddf979ddeead9980606491667acf4837606ef50d631230054c7e4c79180f7a2c6557f4aa747c0aa6ca918325a1045c7ae9a83bc86d8caa467e34284101d9
|
@@ -27,7 +27,7 @@ module Cats
|
|
27
27
|
def model_params
|
28
28
|
params.require(:payload).permit(:batch_no, :description, :unit_of_measure_id, :project_id, :commodity_grade,
|
29
29
|
:source_type, :quantity, :best_use_before, :volume_per_metric_ton,
|
30
|
-
:arrival_status, :shipping_reference)
|
30
|
+
:arrival_status, :shipping_reference, :package_unit_id)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -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
|
@@ -29,7 +29,9 @@ module Cats
|
|
29
29
|
batch_no: item.commodity.batch_no,
|
30
30
|
commodity_id: item.commodity_id,
|
31
31
|
commodity_name: item.commodity.name,
|
32
|
-
unit: item.commodity.unit_abbreviation
|
32
|
+
unit: item.commodity.unit_abbreviation,
|
33
|
+
package_unit_id: item.commodity.package_unit_id,
|
34
|
+
package_unit_abbreviation: item.commodity.package_unit_abbreviation
|
33
35
|
}
|
34
36
|
end
|
35
37
|
end
|
data/lib/cats/core/version.rb
CHANGED