effective_orders 6.16.3 → 6.17.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcd28b8d2dda1a9982419e2cfbb46de103d59de912ba3c95de4bd213389708cc
|
4
|
+
data.tar.gz: 216dab4a26eeeef06bf80b6a71e462ea0834bb084037bd9116b1057e68e8933c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8408c08ee2d9efaa894f53b3f01431410a8888af0cd0f37cca76b7bf429ad8fbe925eb239dd5d3db0a9b4f90459d7360a26fdd0e3d0d1a4a7d6da81c43d0011
|
7
|
+
data.tar.gz: 143ab80fe0744376ba4f3b2bbe1b66a4bbb5971de311cca4953458f983cd0f98fc263255a1d2bea249e0eb14c0301ec62ce2c5df6e0c1a33ab591090a5d5c01f
|
@@ -49,14 +49,47 @@ module ActsAsPurchasable
|
|
49
49
|
validates_with Effective::SoldOutValidator, on: :create
|
50
50
|
end
|
51
51
|
|
52
|
-
scope :purchased, -> {
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
52
|
+
scope :purchased, -> {
|
53
|
+
if respond_to?(:unarchived)
|
54
|
+
unarchived.where.not(purchased_order_id: nil)
|
55
|
+
else
|
56
|
+
where.not(purchased_order_id: nil)
|
57
|
+
end
|
58
|
+
}
|
59
|
+
|
60
|
+
scope :not_purchased, -> {
|
61
|
+
if respond_to?(:unarchived)
|
62
|
+
unarchived.where(purchased_order_id: nil)
|
63
|
+
else
|
64
|
+
where(purchased_order_id: nil)
|
65
|
+
end
|
66
|
+
}
|
67
|
+
|
68
|
+
scope :purchased_or_deferred, -> {
|
69
|
+
if respond_to?(:unarchived)
|
70
|
+
unarchived.joins(order_items: :order).where(orders: { status: [:purchased, :deferred] })
|
71
|
+
else
|
72
|
+
joins(order_items: :order).where(orders: { status: [:purchased, :deferred] })
|
73
|
+
end
|
74
|
+
}
|
75
|
+
|
76
|
+
scope :deferred, -> {
|
77
|
+
if respond_to?(:unarchived)
|
78
|
+
unarchived.joins(order_items: :order).where(orders: { status: :deferred })
|
79
|
+
else
|
80
|
+
joins(order_items: :order).where(orders: { status: :deferred })
|
81
|
+
end
|
82
|
+
}
|
83
|
+
|
84
|
+
scope :purchased_by, -> (user) {
|
85
|
+
if respond_to?(:unarchived)
|
86
|
+
unarchived.joins(order_items: :order).where(orders: { purchased_by: user, status: :purchased }).distinct
|
87
|
+
else
|
88
|
+
joins(order_items: :order).where(orders: { purchased_by: user, status: :purchased }).distinct
|
89
|
+
end
|
90
|
+
}
|
91
|
+
|
92
|
+
scope :not_purchased_by, -> (user) { where.not(id: purchased_by(user)) }
|
60
93
|
end
|
61
94
|
|
62
95
|
module ClassMethods
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_orders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|