cats_core 1.5.9 → 1.5.11

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: e361eda6ed26c77f5ada114d02094efb869df744edfcd13391d6562f8309b7fb
4
- data.tar.gz: af9aa637888114575260726101e49b7a43b456e23ba1747d21bfddfc43da84ed
3
+ metadata.gz: '09ce93a7870328f70727526280966e0bde9b89ece1239cb5e1f58eafc63413d1'
4
+ data.tar.gz: d7aba66726c415bbf63819f989e4913a71c59297f07ef7c2bdeaeed3dee8f4dc
5
5
  SHA512:
6
- metadata.gz: 378ea3f080575f6cf6253fd92626081ea1e069ebaa9fead9e6f4e9fbbe7f4d39f47405a116b98c230accfb422242a12a1f121437d43de1d51c540082ff02975b
7
- data.tar.gz: 68818109735f77c62886c7e4366b9267dc2c61d3ff451a6c9d47d1daa8ea4e76321928001f304278b9ea39e1b22bc0526818d43c288db0ee4100286f19911fb4
6
+ metadata.gz: be96f20f54abce8196b082bc95fc0408d3fdfdd7e6e88f45e4b8b9f6d03317c7724e3e1eab4f948091d731caa6d0cc3513e3e477c5608105a069ae0b9ae3feb1
7
+ data.tar.gz: 3766fa26f634d71c0abb1783af2ffe7f34de84b5f6a9efe629ce755d4f744203f3fe05746ba956321209bf335ff71c953856455859bfb10ed9ff5e314a74ef9b
@@ -24,6 +24,12 @@ module Cats
24
24
  service = StackService.new
25
25
  dispatch = Dispatch.find(params[:id])
26
26
  stacks = service.dispatch_stacks(dispatch)
27
+
28
+ # Filter for current user
29
+ if current_user.details.key?('stores')
30
+ stores = current_user.details['stores']
31
+ stacks = stacks.select { |stack| stores.include?(stack.store_id) }
32
+ end
27
33
  render json: { success: true, data: serialize(stacks) }
28
34
  end
29
35
 
@@ -87,8 +87,8 @@ module Cats
87
87
  woreda: detail.beneficiary_round_plan_item.round_plan_item.woreda.name,
88
88
  fdp: detail.beneficiary_round_plan_item.round_plan_item.fdp.name,
89
89
  commodity_category: detail.round_ration.commodity_category.name,
90
- unit_id: detail.round_ration.unit_of_measure_id,
91
- unit: detail.round_ration.unit_of_measure.abbreviation,
90
+ unit_id: detail.unit_id,
91
+ unit: detail.unit.abbreviation,
92
92
  quantity: detail.quantity,
93
93
  source_id: nil,
94
94
  destination_id: detail.beneficiary_round_plan_item.round_plan_item.fdp.id,
@@ -19,9 +19,10 @@ module Cats
19
19
  round_rations.each do |ration|
20
20
  quantity = (no_of_days / ration.no_of_days * ration.quantity) * plan_item.beneficiaries *
21
21
  round_plan.rounds.count
22
+ quantity = quantity.truncate(2)
22
23
  unit = ration.unit
23
24
  if ration.unit.abbreviation.downcase != 'pc'
24
- quantity = UnitConversion.convert(unit, mt, quantity)
25
+ quantity = UnitConversion.convert(unit, mt, quantity).truncate(2)
25
26
  unit = mt
26
27
  end
27
28
 
@@ -48,7 +48,7 @@ module Cats
48
48
  stores = Store.where(warehouse: warehouses)
49
49
 
50
50
  commodity = dispatch.dispatch_plan_item.commodity
51
- Stack.where(commodity: commodity, store: stores)
51
+ Stack.where(commodity: commodity, store: stores, stack_status: Stack::ALLOCATED)
52
52
  end
53
53
  end
54
54
  end
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.5.9'.freeze
3
+ VERSION = '1.5.11'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cats_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.9
4
+ version: 1.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-03 00:00:00.000000000 Z
11
+ date: 2022-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers