cats_core 1.0.38 → 1.0.42

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: f003ab02e18c4d6748354703954b989a2854beb06d6cedde9a1417dd033b6b0d
4
- data.tar.gz: ec1a54e9e760cf5a8c84109d526b7a6da50696b31bd3647a82b910e108dca482
3
+ metadata.gz: 459a3f07d1fadf11fb8120f91ecf18b2df1b7719e05a2e8398e0af664af1b19b
4
+ data.tar.gz: 92645ac2384a08e79db744e98e8179bcea78112c538c1b6444bbc0a6fa26d34e
5
5
  SHA512:
6
- metadata.gz: d21df2b1e4f3052deda19c879fbc0d3c4f4d5bf9754a7c91e6b7260a7ff1cf64292a68da01d847a9caec74d933cded52952d3de3c627afcd9b6a0bd426019cd0
7
- data.tar.gz: 2afec4b8dedd8eb129bd3ad61cc3bcf766c69eb1fbc0d45ef12f18085b62db3856bbc298720be52cc63f040451904cd966cfc6b64fcf6d57037b76254b63f54b
6
+ metadata.gz: 265613d922d768384446ca0e38e3dfcae4ae2bb9f07a7f8a278ebbc3f2ec87fd8c96f08ae08a5ecc605ee9903701bf8d90f45ba5583524717b65f97ad3264509
7
+ data.tar.gz: 3a8236f40c2f028c8a7cff2abcf2d08c02eb598f577e71bedf8723841301c70cf0f8c0834d36fc1eff6b6a06dca0c6383d5e06e8bdfbed6b82ee747176ca9792
@@ -46,7 +46,7 @@ module Cats
46
46
  end
47
47
 
48
48
  def model_params
49
- params.require(:payload).permit(:name, :location_type, :description, :parent_id)
49
+ params.require(:payload).permit(:code, :name, :location_type, :description, :parent_id)
50
50
  end
51
51
  end
52
52
  end
@@ -9,7 +9,8 @@ module Cats
9
9
  MEHER = 'Meher'.freeze
10
10
  SEASONS = [BELG, MEHER].freeze
11
11
 
12
- belongs_to :ration
12
+ belongs_to :program
13
+ belongs_to :ration, optional: true
13
14
  has_many :hrp_items
14
15
 
15
16
  validates :reference_no, :year, :status, presence: true
@@ -5,6 +5,8 @@ module Cats
5
5
  belongs_to :woreda, -> { where(location_type: Cats::Core::Location::WOREDA) }, class_name: 'Cats::Core::Location'
6
6
  belongs_to :operator
7
7
 
8
+ has_many :hrp_item_details
9
+
8
10
  validates :beneficiaries, presence: true, numericality: { greater_than: 0 }
9
11
  validates :hrp_id, uniqueness: { scope: :woreda_id }
10
12
 
@@ -2,7 +2,6 @@ module Cats
2
2
  module Core
3
3
  class HrpItemDetail < ApplicationRecord
4
4
  belongs_to :hrp_item
5
- belongs_to :hrp_ration
6
5
  belongs_to :ration_item
7
6
 
8
7
  validates :amount, presence: true, numericality: { greater_than: 0 }
@@ -12,7 +12,8 @@ module Cats
12
12
 
13
13
  has_ancestry
14
14
 
15
- validates :name, :location_type, presence: true
15
+ validates :code, :name, :location_type, presence: true
16
+ validates :code, uniqueness: true
16
17
  validates :location_type, inclusion: { in: LOCATION_TYPES }
17
18
  validate :validate_location_parent
18
19
 
@@ -1,6 +1,7 @@
1
1
  class CreateCatsCoreLocations < ActiveRecord::Migration[6.1]
2
2
  def change
3
3
  create_table :cats_core_locations do |t|
4
+ t.string :code, unique: true
4
5
  t.string :name, null: false
5
6
  t.string :location_type, null: false
6
7
  t.string :description
@@ -6,8 +6,12 @@ class CreateCatsCoreHrps < ActiveRecord::Migration[6.1]
6
6
  t.string :season, null: false
7
7
  t.string :status, null: false, default: 'Draft'
8
8
 
9
- t.references :ration,
9
+ t.references :program,
10
10
  null: false,
11
+ index: { name: 'program_on_hrp_indx' },
12
+ foreign_key: { to_table: :cats_core_programs }
13
+ t.references :ration,
14
+ null: true,
11
15
  index: { name: 'ration_on_hrp_indx' },
12
16
  foreign_key: { to_table: :cats_core_rations }
13
17
 
@@ -5,10 +5,6 @@ class CreateCatsCoreHrpItemDetails < ActiveRecord::Migration[6.1]
5
5
  null: false,
6
6
  index: { name: 'hi_on_hid_indx' },
7
7
  foreign_key: { to_table: :cats_core_hrp_items }
8
- t.references :hrp_ration,
9
- null: false,
10
- index: { name: 'hr_on_hid_indx' },
11
- foreign_key: { to_table: :cats_core_hrp_rations }
12
8
  t.references :ration_item,
13
9
  null: false,
14
10
  index: { name: 'ri_on_hid_indx' },
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.0.38'.freeze
3
+ VERSION = '1.0.42'.freeze
4
4
  end
5
5
  end
@@ -1,7 +1,6 @@
1
1
  FactoryBot.define do
2
2
  factory :hrp_item_detail, class: 'Cats::Core::HrpItemDetail' do
3
3
  hrp_item
4
- hrp_ration
5
4
  ration_item
6
5
  amount { 150 }
7
6
  end
@@ -4,6 +4,7 @@ FactoryBot.define do
4
4
  year { 1 }
5
5
  season { Cats::Core::Hrp::BELG }
6
6
  status { Cats::Core::Hrp::DRAFT }
7
+ program
7
8
  ration
8
9
  end
9
10
  end
@@ -1,5 +1,6 @@
1
1
  FactoryBot.define do
2
2
  factory :location, class: 'Cats::Core::Location', aliases: [:parent] do
3
+ code { FFaker::Name.name }
3
4
  name { FFaker::Name.name }
4
5
  location_type { Cats::Core::Location::REGION }
5
6
  ancestry { nil }
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.0.38
4
+ version: 1.0.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
@@ -243,7 +243,6 @@ files:
243
243
  - app/models/cats/core/hrp.rb
244
244
  - app/models/cats/core/hrp_item.rb
245
245
  - app/models/cats/core/hrp_item_detail.rb
246
- - app/models/cats/core/hrp_ration.rb
247
246
  - app/models/cats/core/location.rb
248
247
  - app/models/cats/core/menu.rb
249
248
  - app/models/cats/core/menu_item.rb
@@ -296,7 +295,6 @@ files:
296
295
  - db/migrate/20210717031343_create_cats_core_ration_items.rb
297
296
  - db/migrate/20210717031810_create_cats_core_hrps.rb
298
297
  - db/migrate/20210717032024_create_cats_core_hrp_items.rb
299
- - db/migrate/20210717032106_create_cats_core_hrp_rations.rb
300
298
  - db/migrate/20210717032240_create_cats_core_hrp_item_details.rb
301
299
  - db/migrate/20210717032330_create_cats_core_donations.rb
302
300
  - db/migrate/20210717032602_create_cats_core_gift_certificates.rb
@@ -333,7 +331,6 @@ files:
333
331
  - spec/factories/cats/core/gift_certificates.rb
334
332
  - spec/factories/cats/core/hrp_item_details.rb
335
333
  - spec/factories/cats/core/hrp_items.rb
336
- - spec/factories/cats/core/hrp_rations.rb
337
334
  - spec/factories/cats/core/hrps.rb
338
335
  - spec/factories/cats/core/locations.rb
339
336
  - spec/factories/cats/core/menu_items.rb
@@ -1,10 +0,0 @@
1
- module Cats
2
- module Core
3
- class HrpRation < ApplicationRecord
4
- belongs_to :hrp
5
- belongs_to :ration
6
-
7
- validates :hrp_id, uniqueness: true
8
- end
9
- end
10
- end
@@ -1,17 +0,0 @@
1
- class CreateCatsCoreHrpRations < ActiveRecord::Migration[6.1]
2
- def change
3
- create_table :cats_core_hrp_rations do |t|
4
- t.references :hrp,
5
- null: false,
6
- index: { name: 'hrp_on_hr_indx' },
7
- foreign_key: { to_table: :cats_core_hrps }
8
- t.references :ration,
9
- null: false,
10
- index: { name: 'ration_on_hr_indx' },
11
- foreign_key: { to_table: :cats_core_rations }
12
-
13
- t.timestamps
14
- end
15
- add_index(:cats_core_hrp_rations, :hrp_id, unique: true)
16
- end
17
- end
@@ -1,6 +0,0 @@
1
- FactoryBot.define do
2
- factory :hrp_ration, class: 'Cats::Core::HrpRation' do
3
- hrp
4
- ration
5
- end
6
- end