cats_core 1.1.4 → 1.1.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: 63d1bc4e2e97985bc79c49007a2d826b43caec3b8fc31eca51fa4f588d22e10f
4
- data.tar.gz: d4d08836b88121d75bd29fb711975726285b9ab5f7b64285ed48349cff51e2e3
3
+ metadata.gz: 1edf27e2257545cf71d59da4348838a7d413911a3977e505e9ea38788bbf6bc0
4
+ data.tar.gz: 7b11450abaf98eed4cde168465e0f778be42026895d52883760bbe5cb0b571ae
5
5
  SHA512:
6
- metadata.gz: 6bc9fdab7012e63bcda95512f54f0fe8586c225a8eec25c88dcc3ed6b0634aa21a6a62ba5e6091f21b718f10d9df93eeabdf0a88a62a78891f244dc2c14d3bac
7
- data.tar.gz: 9ced66786a2d6303d5ea944366cf9357ff9d3a9ab8e4406d2a6c490d8969e0c6431b2265e321a965a2ab10c503bc51e4cbdd40766581f8af6ccf844405f58527
6
+ metadata.gz: 26de9f25dc8533a8ad33089cedacf51feff5b7ecfba6c08bfa55d811e7672cd4892955bccdd853a7281ec677a31478c9e3f8ecc2e421c79cbdeb34559b15c7d2
7
+ data.tar.gz: 26c4b80b13de8a60a02545382205877c8a252beebf2943ca990860a5bd32652d1152b865a90940dc0a55eebfca1c3bde974bfb6dfa07addaf174c59a5e74674a
@@ -5,6 +5,16 @@ module Cats
5
5
 
6
6
  validates :reference_no, presence: true, uniqueness: true
7
7
  validates :gift_date, presence: true
8
+
9
+ after_create :update_donation
10
+
11
+ def update_donation
12
+ donation = self.donation
13
+ return if donation.active
14
+
15
+ donation.active = true
16
+ donation.save!
17
+ end
8
18
  end
9
19
  end
10
20
  end
@@ -8,6 +8,16 @@ module Cats
8
8
  validates :reference_no, uniqueness: true
9
9
 
10
10
  delegate(:name, to: :commodity_category, prefix: true)
11
+
12
+ after_create :update_donation
13
+
14
+ def update_donation
15
+ donation = self.donation
16
+ return if donation.active
17
+
18
+ donation.active = true
19
+ donation.save!
20
+ end
11
21
  end
12
22
  end
13
23
  end
@@ -25,6 +25,7 @@ class CreateCatsCoreDonations < ActiveRecord::Migration[6.1]
25
25
  null: true,
26
26
  index: { name: 'uom_on_donation_indx' },
27
27
  foreign_key: { to_table: :cats_core_unit_of_measures }
28
+ t.boolean :active, null: false, default: false
28
29
 
29
30
  t.timestamps
30
31
  end
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.1.4'.freeze
3
+ VERSION = '1.1.5'.freeze
4
4
  end
5
5
  end
@@ -9,5 +9,6 @@ FactoryBot.define do
9
9
  currency { nil }
10
10
  commodity_category
11
11
  unit_of_measure
12
+ active { false }
12
13
  end
13
14
  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.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.