cats_core 1.3.0 → 1.3.4

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: 023c32016bdf9ca32dc84e1b1742df1baa1a3ed44748115551c8d2ca493d01e2
4
- data.tar.gz: 912fd8caf76f4543c5c611aa6f5845914c4f03cd08eab74ba3ee8355f3be3ee4
3
+ metadata.gz: c44a1c208dbd4626ab5eb07ff44c2282e62d37f9ed2023f192de81f948db2b1b
4
+ data.tar.gz: aaad5e4d7d06b00d6277b60abd7b04e398e01122599f225c99fdfe2d777ddad3
5
5
  SHA512:
6
- metadata.gz: 6066a9c4cf2a68e1c352afa61f6e8d592723e57dc8f0786e65c697743863b9d200cee5bd0f41f06012cef1d73f368c58940fa1e5d15c42d8a78234426f8a3cd2
7
- data.tar.gz: 57f4fb61c65e1dcad1815d76f23234f7b58a38f0678ceb60f72b561bec5ac03c014e8a5c5ba7bf8c161fcfae2664865eb96cf1e0d3c29dd56f97caa5c8af5336
6
+ metadata.gz: adde6b14c19da6ea4f651351f42249804a5fe4404293f9a7f80e860c3e11527821016859372307a0b4be13d2b007ffdc5171efd87bdb8a397567db468f12acd8
7
+ data.tar.gz: f28db6afdbab5f01ad463293132d697bbb94870b841833fb795ff6af0a771ca6bf61bc75df9c3067495001055bb50ecb5749ec9dcbaa8e3f9619d4f28f1553dc
@@ -3,6 +3,11 @@ module Cats
3
3
  class RoutesController < ApplicationController
4
4
  include Common
5
5
 
6
+ def filter
7
+ query = Cats::Core::Route.ransack(params[:q])
8
+ render json: { success: true, data: serialize(query.result) }
9
+ end
10
+
6
11
  private
7
12
 
8
13
  def model_params
@@ -1,7 +1,7 @@
1
1
  module Cats
2
2
  module Core
3
3
  class GiftCertificate < ApplicationRecord
4
- belongs_to :donation
4
+ belongs_to :donation, optional: true
5
5
  belongs_to :commodity_category
6
6
  belongs_to :unit_of_measure
7
7
 
@@ -8,6 +8,8 @@ module Cats
8
8
  validates :rank, numericality: { greater_than: 0 }, allow_nil: true
9
9
  validate :validate_rank_is_set_for_winner
10
10
 
11
+ delegate(:route, to: :transport_bid_item)
12
+
11
13
  def mark_as_winner(rank)
12
14
  raise(StandardError, 'Offer item already marked as winner.') if winner
13
15
 
@@ -10,6 +10,8 @@ module Cats
10
10
  validates :source_id, uniqueness: { scope: :destination_id }
11
11
  validate :validate_region, :validate_source, :validate_destination
12
12
 
13
+ delegate(:name, to: :region, prefix: true)
14
+
13
15
  def set_name
14
16
  return unless source && destination
15
17
 
@@ -11,6 +11,7 @@ module Cats
11
11
  has_many :transport_bid_items
12
12
  has_many :transport_offers
13
13
  has_many :offer_items, through: :transport_offers
14
+ has_many :tenderers
14
15
  belongs_to :region, class_name: 'Cats::Core::Location', optional: true
15
16
  belongs_to :transport_plan
16
17
 
@@ -10,6 +10,10 @@ module Cats
10
10
  validates :transport_plan_item_id, uniqueness: true
11
11
 
12
12
  delegate(:reference_no, to: :transport_bid, prefix: true)
13
+
14
+ def route
15
+ transport_plan_item.route.name
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -1,7 +1,7 @@
1
1
  module Cats
2
2
  module Core
3
3
  class RouteSerializer < ActiveModel::Serializer
4
- attributes :id, :name, :source_id, :destination_id
4
+ attributes :id, :name, :source_id, :destination_id, :region_id, :region_name
5
5
  end
6
6
  end
7
7
  end
data/config/routes.rb CHANGED
@@ -66,6 +66,8 @@ Cats::Core::Engine.routes.draw do
66
66
  end
67
67
  resources :currencies, except: %i[destroy]
68
68
  resources :unit_of_measures, except: %i[destroy]
69
+
70
+ post '/routes/filter', controller: :routes, action: :filter
69
71
  resources :routes, except: %i[destroy]
70
72
 
71
73
  post '/dispatch_plans/filter', controller: :dispatch_plans, action: :filter
@@ -5,10 +5,10 @@ class CreateCatsCoreGiftCertificates < ActiveRecord::Migration[6.1]
5
5
  t.date :gift_date, null: false
6
6
 
7
7
  t.references :donation,
8
- null: false,
8
+ null: true,
9
9
  index: { name: 'gc_on_donation_indx' },
10
10
  foreign_key: { to_table: :cats_core_donations }
11
-
11
+
12
12
  t.string :vessel
13
13
  t.string :port
14
14
  t.string :customs_declaration_no
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.3.0'.freeze
3
+ VERSION = '1.3.4'.freeze
4
4
  end
5
5
  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.0
4
+ version: 1.3.4
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-03 00:00:00.000000000 Z
11
+ date: 2022-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers