cats_core 1.2.40 → 1.3.3

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: 382ef1926550e0ed8be588d452dcff996812626947d487c1c56fd243d4c3934a
4
- data.tar.gz: c8344bcba271da309de8c7485946ad63a1996fb950a5abc71c7895299f06b6ec
3
+ metadata.gz: cdba57c2bf858a5e13e6b3fbda47480ebde0daab288fe316227c79fb09a25dca
4
+ data.tar.gz: abd8687cafb652893f8c7acde57e8d44f83a35e0cc60f0cbf38634505ac96b05
5
5
  SHA512:
6
- metadata.gz: 55184af4f9611c41b1ea47cf8807987f2a0913bad1c06d284751d480faa26d62edca5d77963b6d89e8fb6f08a63f06d83dd7081bbe18c11de4b97729725c276d
7
- data.tar.gz: 076f9dfba08a35ea3b670dc72231bb0fc4f5cd43e2441225262c0e5be5f047c6d1448830db4b95e7d63f979b3919ec2a328605b1b9c694b433eb67289f3ea136
6
+ metadata.gz: 37408f5b51f9b8fa476432a57eb5424e76f482e533915f5e9810afdc29b62af9e233019bf8ae209837e07cabd3b6b7645cd1892c233713a94e93c5fecce02ec9
7
+ data.tar.gz: b122ff2735e2f6b2186c38ff01aaf886e5e7317a7a9c956489f481f97991a1e00d9871c00ebe1b1e0013fbe886aeb85bb78ed7274221c21191b1fae2488392a1
@@ -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
@@ -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
 
@@ -5,6 +5,9 @@ module Cats
5
5
  belongs_to :transporter
6
6
 
7
7
  validates :purchased_by, :phone_no, presence: true
8
+
9
+ delegate(:reference_no, to: :transport_bid)
10
+ delegate(:name, to: :transporter, prefix: true)
8
11
  end
9
12
  end
10
13
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.2.40'.freeze
3
+ VERSION = '1.3.3'.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.2.40
4
+ version: 1.3.3
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