cats_core 1.4.34 → 1.4.35

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: 451e4ed5c952d795035700cc1ac97bed84f711c284e15d510214df6a012df397
4
- data.tar.gz: 7725d50aaa4dadfdb5aacf79e6bb733e156dbf78968ea61a4652481a1850fc5f
3
+ metadata.gz: 186d5da451b5abf3212599586408ca925e553e855f185b2ac52038a7cfa7b651
4
+ data.tar.gz: 7fa1c103c95c8f80d98f75be767bf346b4cb5bfab1cf066776e3ae8880a95621
5
5
  SHA512:
6
- metadata.gz: 5d87b3ce53a8e899335e469edd698311bf9324c5ac5fda72b681d236a512882a16800b5092108627fc3ceb8ea9933b06f1b0ba2da8346fbf07dc29da8f5ea9a5
7
- data.tar.gz: cec2931e3d2edb587e58b263bec7ba52f2ce31756f50cb0fe13d0c54be242024452c67d9c5a39185faa923df5db8fab0a6b9e13b7e6e4fd65cc186679e1be8d9
6
+ metadata.gz: cd85c7c41b4a8c7ab65f388969b4e9e6e5a6191c1eaf19c01bcf6cdbef36018d76136ab73c1bcf57b4fe47f81e5ab6062df1da4ca98970aaec7ddef593818bd7
7
+ data.tar.gz: 885be8ea62166c70ae4bf3e4f900ed12a18ddecd0b9ba712643e3fe1e781b4099f7e2b8010ca5fdc14ef57089956fe2c43e2de0f36eabe343d69689b13c4b233
@@ -7,7 +7,7 @@ module Cats
7
7
 
8
8
  raise(StandardError, 'Plan has no plan items.') if round_plan.round_plan_items.count.zero?
9
9
 
10
- round_plan.round_plan_item_details.delete_all if round_plan.round_plan_item_details.count.positive?
10
+ clear_needs(round_plan.id)
11
11
 
12
12
  details = []
13
13
  rations = round_plan.round_rations
@@ -32,6 +32,13 @@ module Cats
32
32
  round_plan
33
33
  end
34
34
 
35
+ def clear_needs(plan_id)
36
+ Cats::Core::RoundPlanItemDetail
37
+ .joins(beneficiary_round_plan_item: :round_plan_item)
38
+ .where(cats_core_beneficiary_round_plan_items: { cats_core_round_plan_items: { round_plan_id: plan_id } })
39
+ .delete_all
40
+ end
41
+
35
42
  def generate_round_plan(reference_no, rounds, plan_id, region_id)
36
43
  round_plan = Cats::Core::RoundPlan.create!(
37
44
  plan_id: plan_id,
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.4.34'.freeze
3
+ VERSION = '1.4.35'.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.4.34
4
+ version: 1.4.35
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-06-05 00:00:00.000000000 Z
11
+ date: 2022-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers