cats_core 1.4.38 → 1.4.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: c9686d605fc55bee82820925cab018c53333b5d35885fddcb98bd211c61f6547
4
- data.tar.gz: 938a5caa85d500edde7ae4302293beffc06cea17930cabffd2272e38861227cd
3
+ metadata.gz: 4084a8e84ceacfb0f4e96ebba6f9c1bfb41cdf64e36341955dfd86131a5de89e
4
+ data.tar.gz: c091888b5e67a9ecc85e3dce2e5fa33aacab4d617bf31767ded0117329c2f4db
5
5
  SHA512:
6
- metadata.gz: dd42170550910db72d5056a21e126faebbbb285eadd135ec57acc09f76e1919c1768525eacae9068466472a88ca87dffca1cb33bd8a74533cf48bc6214e83ca5
7
- data.tar.gz: be577e0ea6605492474c01825bb12e7a179aeddbb96fc0c6778e3a3c6a19813543715fa7a01b6e28e03e628b504b6f83cc6a37b2f5418039e16e47a037690bc2
6
+ metadata.gz: ca7b27982330acd7df6ebf118e9412fcca962f6436903f7e48c0f1603b5d1bcc1a04b6bb5a508cd7579aa42bedb0e62ed548495759f7a7291b91f3f064ccaaa7
7
+ data.tar.gz: dac15feb2a1280d856a5ac280498a4b5e7c1585bccdcf74d4a5f78eb41a8e7562c6bdeebf5f53c150586d964cdd2af5663fc5fa588c6765917118526bd7c57c2
@@ -14,6 +14,15 @@ module Cats
14
14
  render json: { error: 'Unauthorized' }, status: 401 if current_user.nil?
15
15
  end
16
16
 
17
+ # In case we want to disable bullet for specific controller actions
18
+ def skip_bullet
19
+ previous_value = Bullet.enable?
20
+ Bullet.enable = false
21
+ yield
22
+ ensure
23
+ Bullet.enable = previous_value
24
+ end
25
+
17
26
  private
18
27
 
19
28
  def serialize(data)
@@ -4,6 +4,7 @@ module Cats
4
4
  include Common
5
5
  skip_before_action :authenticate, only: %i[start_with_pin]
6
6
  before_action :set_service, only: %i[create_receipt_authorization approve start start_with_pin search confirm]
7
+ around_action :skip_bullet, if: -> { defined?(Bullet) }, only: %i[search start_with_pin]
7
8
 
8
9
  def index
9
10
  super do
@@ -4,6 +4,7 @@ module Cats
4
4
  include Common
5
5
 
6
6
  before_action :set_service, only: %i[approve generate remove_items generate_round_needs]
7
+ around_action :skip_bullet, if: -> { defined?(Bullet) }, only: %i[generate generate_round_needs remove_items]
7
8
 
8
9
  def index
9
10
  super do
@@ -3,6 +3,8 @@ module Cats
3
3
  class UsersController < ApplicationController
4
4
  include Common
5
5
 
6
+ around_action :skip_bullet, if: -> { defined?(Bullet) }, only: %i[stores]
7
+
6
8
  def index
7
9
  super do
8
10
  User.joins(:application_module).where(cats_core_application_modules: { prefix: params[:prefix] })
@@ -11,7 +11,7 @@ module Cats
11
11
  belongs_to :commodity_category, optional: true
12
12
  belongs_to :unit_of_measure, optional: true
13
13
 
14
- validates :reference_no, :amount, :donation_type, :donated_on, :agency, presence: true
14
+ validates :reference_no, :amount, :donation_type, :donated_on, presence: true
15
15
  validates :reference_no, uniqueness: true
16
16
  validates :donation_type, inclusion: { in: DONATION_TYPES }
17
17
  validates :currency, presence: true, if: -> { donation_type == CASH }
@@ -2,10 +2,14 @@ module Cats
2
2
  module Core
3
3
  class Project < ApplicationRecord
4
4
  belongs_to :source, polymorphic: true
5
+ belongs_to :program
5
6
 
6
7
  validates :code, presence: true, uniqueness: true
7
8
  validates :year, :implementing_agency, presence: true
8
9
  validates :year, numericality: { greater_than: 2000 }
10
+
11
+ delegate(:code, to: :program, prefix: true)
12
+ delegate(:reference_no, to: :source, prefix: true)
9
13
  end
10
14
  end
11
15
  end
@@ -6,7 +6,6 @@ class CreateCatsCoreDonations < ActiveRecord::Migration[6.1]
6
6
  t.string :donation_type, null: false
7
7
  t.string :shipping_reference
8
8
  t.date :donated_on, null: false
9
- t.string :agency, null: false
10
9
  t.references :donor,
11
10
  null: false,
12
11
  index: { name: 'donor_on_donation_indx' },
@@ -4,6 +4,10 @@ class CreateCatsCoreProjects < ActiveRecord::Migration[7.0]
4
4
  t.string :code, unique: true
5
5
  t.string :description
6
6
  t.references :source, polymorphic: true
7
+ t.references :program,
8
+ null: false,
9
+ index: { name: 'program_on_projects_indx' },
10
+ foreign_key: { to_table: :cats_core_programs }
7
11
  t.integer :year, null: false
8
12
  t.string :implementing_agency, null: false
9
13
 
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.4.38'.freeze
3
+ VERSION = '1.4.41'.freeze
4
4
  end
5
5
  end
@@ -5,7 +5,6 @@ FactoryBot.define do
5
5
  donation_type { Cats::Core::Donation::KIND }
6
6
  shipping_reference { FFaker::Name.name }
7
7
  donated_on { Date.today }
8
- agency { 'WFP' }
9
8
  donor
10
9
  plan
11
10
  amount { 100 }
@@ -3,6 +3,7 @@ FactoryBot.define do
3
3
  code { FFaker::Name.name }
4
4
  description { FFaker::Name.name }
5
5
  source factory: :gift_certificate
6
+ program
6
7
  year { 2022 }
7
8
  implementing_agency { FFaker::Name.name }
8
9
  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.4.38
4
+ version: 1.4.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.