cats_core 1.1.1 → 1.1.2

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: e1410fa75e3f9e4eb96e4c9df8cbd6bb358bb56e4cce6ef42b095aff3b6331b1
4
- data.tar.gz: c1529759ffa5ba650bd31df10ae302943afc14e876fff0710a35144cf0841981
3
+ metadata.gz: ae62c0b230969901c7405d3bdf56b72dc099e77e4e6d9a21ba89243f91a1bd07
4
+ data.tar.gz: cc0d85257ffb25fc70a890011b1ae670dd18a0ea6938f79e73ec87a757787cd1
5
5
  SHA512:
6
- metadata.gz: 9b31f50e3f08e9a65c1da38520f3afef988613654e5250607e48761274951d3be4975e6b47c704c65ad6211d03081ab1c60b3f6ae1eea6fae191d498bd021110
7
- data.tar.gz: 4046501c4c360769d9bc23628f4e067b8c7b55d95f898d57fda4f202f75ddc73fa5d5a60e5f163cf37ab340024b12a28065bb80f8be9eb5f5fb64d81151e8863
6
+ metadata.gz: 582d0f4d63492a2ce3b3e12a7d6e84088c5c5badab3135cb108fc8876348f3e593f70d0498d6c23e79de143efb04436fd858325c6bac8a5bf29785d3a1d4d899
7
+ data.tar.gz: 581e221e3dff760e51095cc7094736b0a2c7f7c261d4693c8f811f3b9e2aac1ee5093ba6823895bb910488947f8616cee32b799178b5d1da64905ca40cc7b20c
@@ -52,7 +52,7 @@ module Cats
52
52
  end
53
53
 
54
54
  def search
55
- data = @service.search(current_user)
55
+ data = @service.search(current_user, params[:status])
56
56
  render json: { success: true, data: serialize(data) }
57
57
  end
58
58
 
@@ -4,7 +4,9 @@ module Cats
4
4
  # Receipt status
5
5
  DRAFT = 'Draft'.freeze
6
6
  CONFIRMED = 'Confirmed'.freeze
7
- RECEIPT_STATUSES = [DRAFT, CONFIRMED].freeze
7
+ STACKING = 'Stacking'.freeze
8
+ STACKED = 'Stacked'.freeze
9
+ RECEIPT_STATUSES = [DRAFT, CONFIRMED, STACKING, STACKED].freeze
8
10
 
9
11
  belongs_to :dispatch
10
12
  belongs_to :prepared_by, class_name: 'Cats::Core::User'
@@ -40,7 +40,7 @@ module Cats
40
40
  dispatch
41
41
  end
42
42
 
43
- def search(user)
43
+ def search(user, status)
44
44
  details = user.details
45
45
 
46
46
  unless details['stores'] || details['warehouse'] || details['hub']
@@ -54,12 +54,12 @@ module Cats
54
54
  dispatches = Cats::Core::Dispatch.joins(:allocation_item)
55
55
  .where(
56
56
  allocation_item: { destination: hub },
57
- dispatch_status: Cats::Core::Dispatch::STARTED
57
+ dispatch_status: status
58
58
  ).or(
59
59
  Cats::Core::Dispatch.joins(:allocation_item)
60
60
  .where(
61
61
  allocation_item: { destination: warehouse },
62
- dispatch_status: Cats::Core::Dispatch::STARTED
62
+ dispatch_status: status
63
63
  )
64
64
  )
65
65
  elsif details['warehouse']
@@ -68,12 +68,12 @@ module Cats
68
68
  dispatches = Cats::Core::Dispatch.joins(:allocation_item)
69
69
  .where(
70
70
  allocation_item: { destination: hub },
71
- dispatch_status: Cats::Core::Dispatch::STARTED
71
+ dispatch_status: status
72
72
  ).or(
73
73
  Cats::Core::Dispatch.joins(:allocation_item)
74
74
  .where(
75
75
  allocation_item: { destination: warehouse },
76
- dispatch_status: Cats::Core::Dispatch::STARTED
76
+ dispatch_status: status
77
77
  )
78
78
  )
79
79
  elsif details['hub']
@@ -81,7 +81,7 @@ module Cats
81
81
  dispatches = Cats::Core::Dispatch.joins(:allocation_item)
82
82
  .where(
83
83
  allocation_item: { destination: hub },
84
- dispatch_status: Cats::Core::Dispatch::STARTED
84
+ dispatch_status: status
85
85
  )
86
86
  end
87
87
  dispatches
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.1.1'.freeze
3
+ VERSION = '1.1.2'.freeze
4
4
  end
5
5
  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.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.