cats_core 1.5.27 → 1.5.28
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 +4 -4
- data/app/controllers/cats/core/dispatch_plans_controller.rb +15 -0
- data/config/routes.rb +2 -0
- data/lib/cats/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f4c5959fbfc273f8809d25ec667efe26c657ecaf5ffee395db78d7a5082344d
|
4
|
+
data.tar.gz: f9e7f7f16def88dbd3f228dece31bdfce72b1d546899a93671a345994aaf23b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/cats/core/version.rb
CHANGED
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.
|
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
|
+
date: 2023-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|