cats_core 1.5.27 → 1.5.28

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: 2865fcf1ffc5a821dd2011d92cb64aa062ff61441c82c1c510af16035827f082
4
- data.tar.gz: 8e5c5bc4826e22b2e7cdf6aa4cd2b29466085e7a4ce296121b074f59a71adc37
3
+ metadata.gz: 9f4c5959fbfc273f8809d25ec667efe26c657ecaf5ffee395db78d7a5082344d
4
+ data.tar.gz: f9e7f7f16def88dbd3f228dece31bdfce72b1d546899a93671a345994aaf23b2
5
5
  SHA512:
6
- metadata.gz: a6c116447db30f695bad8135801888cd90878bc53e84e284bf6f648e4ac56e469ea9f8abaea4c8120ce04220d7e8b83a8cb8fdd529a37b0b3308c70f48ff622f
7
- data.tar.gz: 5393dbaab893533aa60034deab2ce0e3827dad922f70f254ebad50c7f411e77dca0bad8e9daf3441b15ed2bf4f0d92c61e79de784eabb94bfd76244b6cfd92f0
6
+ metadata.gz: a965719b330ddaca566572abe5c8a5aec87214f53cfd465c2199477a7e9d5d1b7d43cd07748e2ad0f27a0a6eebc9642d864fccd5fa91dfeb2571137494fe0749
7
+ data.tar.gz: 0c2d16529bdee5a560c756e3feeb0b37924bfe531e17771b721ee242024938ed0ca0d52f28bf09899c45a198b5c16ad058e1bd17eaec6747367246f6aaaf63db
@@ -14,6 +14,21 @@ module Cats
14
14
  render json: {success: true, data: serialize(plans)}
15
15
  end
16
16
 
17
+ def plans_for_location
18
+ if params[:location_type] == "source"
19
+ plans = DispatchPlan.includes([:dispatchable]).joins(:dispatch_plan_items)
20
+ .where(status: Cats::Core::DispatchPlan::APPROVED,
21
+ upstream: false,
22
+ dispatch_plan_items: {source_id: params[:location_id]}).uniq
23
+ elsif params[:location_type] == "destination"
24
+ plans = DispatchPlan.includes([:dispatchable]).joins(:dispatch_plan_items)
25
+ .where(status: Cats::Core::DispatchPlan::APPROVED,
26
+ upstream: false,
27
+ dispatch_plan_items: {destination_id: params[:location_id]}).uniq
28
+ end
29
+ render json: {success: true, data: serialize(plans)}
30
+ end
31
+
17
32
  def filter
18
33
  query = DispatchPlan.ransack(params[:q])
19
34
  render json: {success: true, data: serialize(query.result)}
data/config/routes.rb CHANGED
@@ -100,6 +100,8 @@ Cats::Core::Engine.routes.draw do
100
100
  resources :loans, except: %i[destory]
101
101
 
102
102
  post "/dispatch_plans/filter", controller: :dispatch_plans, action: :filter
103
+ post "/dispatch_plans/filter_by_location", controller: :dispatch_plans,
104
+ action: :plans_for_location, as: :filter_plan_by_location
103
105
  post "/dispatch_plans/bulk_create"
104
106
  resources :dispatch_plans do
105
107
  member do
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = "1.5.27".freeze
3
+ VERSION = "1.5.28".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.5.27
4
+ version: 1.5.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-30 00:00:00.000000000 Z
11
+ date: 2023-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers