cats_core 1.5.4 → 1.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9a6ea1b862a6804a3e215898c7aac9966ffedbdf7aa3c8d9661f9356c4b8a24
4
- data.tar.gz: f08e17d946b62d02d148cffbe97ab52c9b1f113245d4dffca6f5d67256ec7ea0
3
+ metadata.gz: a6b9bb64c4119d94cb514bf76741d6160682cb7adfb376daf9aff38b14fccf77
4
+ data.tar.gz: 0c5b176315cfbd52ed72f3214831705bdd9a8e7fc524e2689517a3e1ff0d29cd
5
5
  SHA512:
6
- metadata.gz: ea2045f6a7a7954a4157952747c932e096f5df6e8ab2a56e888ca1f656a85eb7bd08a572ad0f15a05b53b0defc51354c27755be960c69c4c0ec49b232ad9b5db
7
- data.tar.gz: d91d382689b7abab6221e64457123334bc93bc0357ffdf6eb28e71466d46183ba3aeab2b0d01b24abb0184a7b01b06ae5d0e2331220b710b3a193ac751061ad6
6
+ metadata.gz: d3e0601550aebf25d5238ac8d9aabb57d933f3f48208bfe3a0cd39872a32e267dc97826c77eec6db841e40ae712ad4c7fded2ddb59b69da38f4ae874c5e4548b
7
+ data.tar.gz: '09ae2320e6fdfa2ec17b922068240768a0f614947b7de1ebbdc91fa412ecbd08e7b874593352e205975bb8647ddcf3e42959f51bdb14a9be335ef6a41d407376'
@@ -12,6 +12,8 @@ module Cats
12
12
  delegate(:name, to: :beneficiary_category, prefix: true)
13
13
  delegate(:abbreviation, to: :unit_of_measure, prefix: true)
14
14
  delegate(:reference_no, to: :round_plan, prefix: true)
15
+
16
+ alias_attribute :unit, :unit_of_measure
15
17
  end
16
18
  end
17
19
  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
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.5.4'.freeze
3
+ VERSION = '1.5.5'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cats_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.