cats_core 1.0.16 → 1.0.20

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: 38525dbc996619fc301d108816acab2e97b65362a5feca9251a6c112b53dc3c6
4
- data.tar.gz: 465da29b3725b9f51bd9b9b34857e5b4edfefeaaf24f7d8b7b3cffbd485067c7
3
+ metadata.gz: 1e43803d54552bb7ba268834f78d698a473b0228e72d84f368840376b455c676
4
+ data.tar.gz: f66be9d90ee324a3b986534137e68010c47451fcbf7a64143afa15b369b0a979
5
5
  SHA512:
6
- metadata.gz: 02b4f3b1693f0eb5a1e4108861a65f0a27a8852682a80a9ee62060cdc58d28849258e9c518909a850157eec2bd963a50bd7cedd6a6439ffbb9dc3e62c175b761
7
- data.tar.gz: e6a6d7d6d7af63671e28ae6f48d8128811e5bc04125a70c2027aae0d5604478ff3c0ea056cb33a12b8c0e6105b7db1eea762f2fbd187365c55e3be0738c60b7c
6
+ metadata.gz: fca03d960014c11e58d50b5feb9448e8225bf0ff669e55c851d30b2673ec9aa68bdf9be47274a7c0b04b705108e5fce20d6e17806f2e9b287d2c3411548155cd
7
+ data.tar.gz: c2e9e3fc5caf396c90091e246cd235acfaad8991ff0345d24aec4e568319d2202e73e4b726cd52c866b8fb98c62bea98fc5b8d7d619512a73bb13cb855a64fd9
@@ -1,9 +1,9 @@
1
1
  module Cats
2
2
  module Core
3
3
  class Donation < ApplicationRecord
4
- FUND = 'Fund'.freeze
4
+ CASH = 'Cash'.freeze
5
5
  KIND = 'Kind'.freeze
6
- DONATION_TYPES = [FUND, KIND].freeze
6
+ DONATION_TYPES = [CASH, KIND].freeze
7
7
 
8
8
  belongs_to :donor
9
9
  belongs_to :hrp
@@ -12,7 +12,7 @@ module Cats
12
12
  validates :reference_no, :donation_type, :donated_on, presence: true
13
13
  validates :reference_no, uniqueness: true
14
14
  validates :donation_type, inclusion: { in: DONATION_TYPES }
15
- validates :currency, :amount, presence: true, if: -> { donation_type == FUND }
15
+ validates :currency, :amount, presence: true, if: -> { donation_type == CASH }
16
16
  end
17
17
  end
18
18
  end
@@ -5,10 +5,15 @@ module Cats
5
5
  APPROVED = 'Approved'.freeze
6
6
  STATUSES = [DRAFT, APPROVED].freeze
7
7
 
8
- belongs_to :program
8
+ BELG = 'Belg'.freeze
9
+ MEHER = 'Meher'.freeze
10
+ SEASONS = [BELG, MEHER].freeze
11
+
9
12
  belongs_to :ration
13
+ has_many :hrp_items
10
14
 
11
- validates :reference_no, :year, :season, :status, presence: true
15
+ validates :reference_no, :year, :status, presence: true
16
+ validates :season, presence: true, inclusion: { in: SEASONS }
12
17
  validates :reference_no, uniqueness: true
13
18
  validates :status, inclusion: { in: STATUSES }
14
19
  end
@@ -7,6 +7,7 @@ module Cats
7
7
 
8
8
  validates :beneficiaries, presence: true, numericality: { greater_than: 0 }
9
9
  validates :commodity_amount, presence: true, numericality: { greater_than: 0 }
10
+ validates :hrp_id, uniqueness: { scope: :woreda_id }
10
11
  end
11
12
  end
12
13
  end
@@ -5,7 +5,6 @@ module Cats
5
5
  rolify role_cname: 'Cats::Core::Role'
6
6
 
7
7
  belongs_to :application_module
8
- has_and_belongs_to_many :roles, join_table: :cats_core_users_cats_core_roles
9
8
  has_many :notifications, as: :recipient
10
9
 
11
10
  validates :password, length: { minimum: 6 }, if: proc { |u| u.password.present? }, on: :update
@@ -5,10 +5,7 @@ class CreateCatsCoreHrps < ActiveRecord::Migration[6.1]
5
5
  t.integer :year, null: false
6
6
  t.string :season, null: false
7
7
  t.string :status, null: false, default: 'Draft'
8
- t.references :program,
9
- null: false,
10
- index: { name: 'program_on_hrp_indx' },
11
- foreign_key: { to_table: :cats_core_programs }
8
+
12
9
  t.references :ration,
13
10
  null: false,
14
11
  index: { name: 'ration_on_hrp_indx' },
@@ -18,5 +18,7 @@ class CreateCatsCoreHrpItems < ActiveRecord::Migration[6.1]
18
18
 
19
19
  t.timestamps
20
20
  end
21
+
22
+ add_index :cats_core_hrp_items, [:hrp_id, :woreda_id], unique: true
21
23
  end
22
24
  end
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.0.16'.freeze
3
+ VERSION = '1.0.20'.freeze
4
4
  end
5
5
  end
@@ -2,9 +2,8 @@ FactoryBot.define do
2
2
  factory :hrp, class: 'Cats::Core::Hrp' do
3
3
  reference_no { FFaker::Name.name }
4
4
  year { 1 }
5
- season { FFaker::Name.name }
5
+ season { Cats::Core::Hrp::BELG }
6
6
  status { Cats::Core::Hrp::DRAFT }
7
- program
8
7
  ration
9
8
  end
10
9
  end
@@ -4,5 +4,6 @@ FactoryBot.define do
4
4
  program
5
5
  commodity_category
6
6
  amount { 1.5 }
7
+ current { false }
7
8
  end
8
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.0.16
4
+ version: 1.0.20
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-03 00:00:00.000000000 Z
11
+ date: 2021-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers