cats_core 1.0.37 → 1.0.41

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: c131ef4d30c89f95283ca736b6da138361fdcb1641d6a667431d3a4aaeab96a5
4
- data.tar.gz: cbd3917a4592cf72eecd527f82a766831761a92c51554da72aa60806973dbd12
3
+ metadata.gz: 1a3d6fa190673652349c149ea87b314da07a74f00c600d774f2911ca4da24a35
4
+ data.tar.gz: 7c29148233b0fc4a2e9efc1c114cb02910967d679420cfa5f40aca7eb0a92083
5
5
  SHA512:
6
- metadata.gz: 1223c5b27c6bec3b5e511f61e387711ad4c4943dfb7b85470e9f71261b76e1aacf90c4365f6abfe41dd415227f291d78665798a60850f5641871ebeba0f56f43
7
- data.tar.gz: af61ab9c795d2621f2cf4fd01c865bfb223874ff3725f094117c088e2acd29fb2e2158aa935c651428ef19b484a227380baec502c357b3384a82c67f30d7416f
6
+ metadata.gz: f37e6d2c1f1ff4d5c75df983a259c739d65de04d8d6da3f853dbe8994133f9ec7779c7b0948130ec9081e7127de062287271aa69703f0c5aa790588af6110a58
7
+ data.tar.gz: 7b4f03e36d240e6ae05d04f46c9cef15f9ec86c0cf6f1bbc871eda27fa5f5d5cd9d0971f016a55ef97e8a7b71413d88ec9d1d156bb376506ad8e68e57be83d21
@@ -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,8 +5,9 @@ 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
- validates :commodity_amount, presence: true, numericality: { greater_than: 0 }
10
11
  validates :hrp_id, uniqueness: { scope: :woreda_id }
11
12
 
12
13
  delegate(:name, to: :woreda, prefix: true)
@@ -0,0 +1,11 @@
1
+ module Cats
2
+ module Core
3
+ class HrpItemDetail < ApplicationRecord
4
+ belongs_to :hrp_item
5
+ belongs_to :ration_item
6
+
7
+ validates :amount, presence: true, numericality: { greater_than: 0 }
8
+ validates :hrp_item_id, uniqueness: { scope: :ration_item_id }
9
+ end
10
+ end
11
+ end
@@ -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
 
@@ -10,7 +10,6 @@ class CreateCatsCoreHrpItems < ActiveRecord::Migration[6.1]
10
10
  index: { name: 'woreda_on_hrp_items_idnx' },
11
11
  foreign_key: { to_table: :cats_core_locations }
12
12
  t.integer :beneficiaries, null: false
13
- t.float :commodity_amount, null: false
14
13
  t.references :operator,
15
14
  null: false,
16
15
  index: { name: 'operator_on_hrp_items_indx' },
@@ -0,0 +1,18 @@
1
+ class CreateCatsCoreHrpItemDetails < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_hrp_item_details do |t|
4
+ t.references :hrp_item,
5
+ null: false,
6
+ index: { name: 'hi_on_hid_indx' },
7
+ foreign_key: { to_table: :cats_core_hrp_items }
8
+ t.references :ration_item,
9
+ null: false,
10
+ index: { name: 'ri_on_hid_indx' },
11
+ foreign_key: { to_table: :cats_core_ration_items }
12
+ t.float :amount, null: false
13
+
14
+ t.timestamps
15
+ end
16
+ add_index(:cats_core_hrp_item_details, [:hrp_item_id, :ration_item_id], unique: true, name: 'hii_rii_on_hid_indx')
17
+ end
18
+ end
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.0.37'.freeze
3
+ VERSION = '1.0.41'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :hrp_item_detail, class: 'Cats::Core::HrpItemDetail' do
3
+ hrp_item
4
+ ration_item
5
+ amount { 150 }
6
+ end
7
+ end
@@ -3,7 +3,6 @@ FactoryBot.define do
3
3
  hrp
4
4
  woreda
5
5
  beneficiaries { 100 }
6
- commodity_amount { 100 }
7
6
  operator
8
7
  end
9
8
  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
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.0.37
4
+ version: 1.0.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-18 00:00:00.000000000 Z
11
+ date: 2021-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -242,6 +242,7 @@ files:
242
242
  - app/models/cats/core/gift_certificate.rb
243
243
  - app/models/cats/core/hrp.rb
244
244
  - app/models/cats/core/hrp_item.rb
245
+ - app/models/cats/core/hrp_item_detail.rb
245
246
  - app/models/cats/core/location.rb
246
247
  - app/models/cats/core/menu.rb
247
248
  - app/models/cats/core/menu_item.rb
@@ -294,6 +295,7 @@ files:
294
295
  - db/migrate/20210717031343_create_cats_core_ration_items.rb
295
296
  - db/migrate/20210717031810_create_cats_core_hrps.rb
296
297
  - db/migrate/20210717032024_create_cats_core_hrp_items.rb
298
+ - db/migrate/20210717032240_create_cats_core_hrp_item_details.rb
297
299
  - db/migrate/20210717032330_create_cats_core_donations.rb
298
300
  - db/migrate/20210717032602_create_cats_core_gift_certificates.rb
299
301
  - db/migrate/20210717032855_create_cats_core_purchase_orders.rb
@@ -327,6 +329,7 @@ files:
327
329
  - spec/factories/cats/core/donations.rb
328
330
  - spec/factories/cats/core/donors.rb
329
331
  - spec/factories/cats/core/gift_certificates.rb
332
+ - spec/factories/cats/core/hrp_item_details.rb
330
333
  - spec/factories/cats/core/hrp_items.rb
331
334
  - spec/factories/cats/core/hrps.rb
332
335
  - spec/factories/cats/core/locations.rb