cats_core 1.3.8 → 1.3.12

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: b1553e2d695935cb7ac616b368580c59cef5f8a92b277829e41a8dd4ca7ff46b
4
- data.tar.gz: 47d3a8a40f9e0c6ac3a8bddd98d2fb60943ade15288a3453b168273205f8f726
3
+ metadata.gz: '08f2f20d4acef0ef129992bee4c7f78ef4bfbd3fe239e500487ff6a2a3a247ae'
4
+ data.tar.gz: d01a26f3a74c9cf2a0ce1ef0545a8a4c09cb8a28cd7249772df7bfa43fc46432
5
5
  SHA512:
6
- metadata.gz: c78f415988f1055f643caa4e6479c94b72f92b9c76775a1ab5bcd8578e52b999d49f43884d7b6177b7f76113db3571924bc2226390235057e244d695a060bd54
7
- data.tar.gz: 1a7d8a00314ad8a56e0bc802f164fc9d48e600d9b97cfe609db2c81ef69fd175f44b28dbeae46e4a0d0a498586ddd35c8af98b6f394675cfdddae23b79dd0175
6
+ metadata.gz: d7b74a89b8a98f3c3a42281cd6cb8fe7f951b4cca766c089890e0e51361594e989c310b71fd194ee6ffeddd614f80d587056aea8269b9725fdbe31c4b2d44d88
7
+ data.tar.gz: 860b2fdfd704fbc6cbbc31c57816f097edef10f94911d9d4f1f59503e8e96da8229fa40fbdd47f15604d34de5fa17148dd7c46968187068429a7cddfe25dbbd6
@@ -1,10 +1,12 @@
1
1
  module Cats
2
2
  module Core
3
3
  class MonthlyPlan < ApplicationRecord
4
- belongs_to :ration
5
4
  belongs_to :plan
6
5
  belongs_to :regional_request
7
6
 
7
+ has_many :monthly_plan_items
8
+ has_many :monthly_rations
9
+
8
10
  validates :reference_no, presence: true, uniqueness: true
9
11
  validates :status, presence: true, inclusion: { in: Cats::Core::Plan::STATUSES }
10
12
 
@@ -4,6 +4,8 @@ module Cats
4
4
  belongs_to :monthly_plan
5
5
  belongs_to :plan_item
6
6
 
7
+ has_many :monthly_plan_item_details
8
+
7
9
  validates :beneficiaries, presence: true, numericality: { greater_than: 0 }
8
10
  end
9
11
  end
@@ -0,0 +1,15 @@
1
+ module Cats
2
+ module Core
3
+ class MonthlyRation < ApplicationRecord
4
+ belongs_to :commodity_category
5
+ belongs_to :unit_of_measure
6
+ belongs_to :monthly_plan
7
+
8
+ validates :amount, :no_of_days, presence: true, numericality: { greater_than: 0 }
9
+
10
+ delegate(:name, to: :commodity_category, prefix: true)
11
+ delegate(:abbreviation, to: :unit_of_measure, prefix: true)
12
+ delegate(:reference_no, to: :monthly_plan, prefix: true)
13
+ end
14
+ end
15
+ end
@@ -3,10 +3,6 @@ class CreateCatsCoreMonthlyPlans < ActiveRecord::Migration[6.1]
3
3
  create_table :cats_core_monthly_plans do |t|
4
4
  t.string :reference_no, unique: true
5
5
  t.string :status, null: false, default: 'Draft'
6
- t.references :ration,
7
- null: false,
8
- index: { name: 'ration_on_mp_indx' },
9
- foreign_key: { to_table: :cats_core_rations }
10
6
  t.references :plan,
11
7
  null: false,
12
8
  index: { name: 'plan_on_mp_indx' },
@@ -14,7 +10,7 @@ class CreateCatsCoreMonthlyPlans < ActiveRecord::Migration[6.1]
14
10
  t.references :regional_request,
15
11
  null: false,
16
12
  index: { name: 'rr_on_mp_indx' },
17
- foreign_key: { to_table: :cats_core_regional_requests }
13
+ foreign_key: { to_table: :cats_core_regional_requests }
18
14
 
19
15
  t.timestamps
20
16
  end
@@ -0,0 +1,22 @@
1
+ class CreateCatsCoreMonthlyRations < ActiveRecord::Migration[6.1]
2
+ def change
3
+ create_table :cats_core_monthly_rations do |t|
4
+ t.references :commodity_category,
5
+ null: false,
6
+ index: { name: 'cc_on_mr_indx' },
7
+ foreign_key: { to_table: :cats_core_commodity_categories }
8
+ t.float :amount, null: false
9
+ t.references :unit_of_measure,
10
+ null: false,
11
+ index: { name: 'uom_on_mr_indx' },
12
+ foreign_key: { to_table: :cats_core_unit_of_measures }
13
+ t.integer :no_of_days, null: false
14
+ t.references :monthly_plan,
15
+ index: { name: 'mp_on_mr_indx' },
16
+ null: false,
17
+ foreign_key: { to_table: :cats_core_monthly_plans }
18
+
19
+ t.timestamps
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.3.8'.freeze
3
+ VERSION = '1.3.12'.freeze
4
4
  end
5
5
  end
@@ -2,7 +2,6 @@ FactoryBot.define do
2
2
  factory :monthly_plan, class: 'Cats::Core::MonthlyPlan' do
3
3
  reference_no { FFaker::Name.name }
4
4
  status { Cats::Core::Plan::DRAFT }
5
- ration
6
5
  plan
7
6
  regional_request
8
7
  end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :monthly_ration, class: 'Cats::Core::MonthlyRation' do
3
+ commodity_category
4
+ amount { 100 }
5
+ unit_of_measure
6
+ no_of_days { 30 }
7
+ monthly_plan
8
+ end
9
+ 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.3.8
4
+ version: 1.3.12
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-01-07 00:00:00.000000000 Z
11
+ date: 2022-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -272,6 +272,7 @@ files:
272
272
  - app/models/cats/core/monthly_plan.rb
273
273
  - app/models/cats/core/monthly_plan_item.rb
274
274
  - app/models/cats/core/monthly_plan_item_detail.rb
275
+ - app/models/cats/core/monthly_ration.rb
275
276
  - app/models/cats/core/notification.rb
276
277
  - app/models/cats/core/notification_rule.rb
277
278
  - app/models/cats/core/offer_item.rb
@@ -388,6 +389,7 @@ files:
388
389
  - db/migrate/20220107121752_create_cats_core_monthly_plans.rb
389
390
  - db/migrate/20220107125025_create_cats_core_monthly_plan_items.rb
390
391
  - db/migrate/20220107132433_create_cats_core_monthly_plan_item_details.rb
392
+ - db/migrate/20220107224630_create_cats_core_monthly_rations.rb
391
393
  - lib/cats/core.rb
392
394
  - lib/cats/core/engine.rb
393
395
  - lib/cats/core/version.rb
@@ -414,6 +416,7 @@ files:
414
416
  - spec/factories/cats/core/monthly_plan_item_details.rb
415
417
  - spec/factories/cats/core/monthly_plan_items.rb
416
418
  - spec/factories/cats/core/monthly_plans.rb
419
+ - spec/factories/cats/core/monthly_rations.rb
417
420
  - spec/factories/cats/core/notification_rules.rb
418
421
  - spec/factories/cats/core/notifications.rb
419
422
  - spec/factories/cats/core/offer_items.rb