effective_orders 6.16.4 → 6.17.1

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: dc70e63297bba4d6b81db96f3fde44ea6cd46afb084498cb7e462c2bebe7c8ba
4
- data.tar.gz: bbd17f89c21994543925a0ddd5862ad3bc2e47318da9de27c45c41129e924e95
3
+ metadata.gz: 1694915aa5c646859677437bf8eef6227c2301dd850928cb4d7c179fcf74a17a
4
+ data.tar.gz: 702d26261725a04e5ef44ae247aa98719204f2090d99f0e7326ec91422f792a2
5
5
  SHA512:
6
- metadata.gz: '087d6eb535b19ef97af82fe9cfd6b399da6954121e36567b316cbd8576d98b6de3d71dc9d10198bd08670f6ff2ad928591730bfa2fb4ee3175a6986c39dc2fcd'
7
- data.tar.gz: 1558fa105fbad61f78be06a0e0757dd823731e205915fb3d780a02eb51ab21feb38354b03c2598e08509e7de35daa22314b9152bde59b0a83d24cbb2f961dfed
6
+ metadata.gz: eace5c4d6ab80404524a861323b58dff8e7f84af4714ec3001eb29724faf545dda03312a5c92b362364512e93113051c601428455a43689be8912d0318192a96
7
+ data.tar.gz: c63d78cc2e5e97c66f4995124753722bcd55ba7ed7edc2b28ccf58bf62dc710ad02298339fc8935fc115284efabffda2ac5280ee971ed5d8b88054a134b90ddf
@@ -49,14 +49,47 @@ module ActsAsPurchasable
49
49
  validates_with Effective::SoldOutValidator, on: :create
50
50
  end
51
51
 
52
- scope :purchased, -> { where.not(purchased_order_id: nil) }
53
- scope :not_purchased, -> { where(purchased_order_id: nil) }
54
-
55
- scope :purchased_by, lambda { |user| joins(order_items: :order).where(orders: { purchased_by: user, status: :purchased }).distinct }
56
- scope :not_purchased_by, lambda { |user| where.not(id: purchased_by(user)) }
57
-
58
- scope :purchased_or_deferred, -> { joins(order_items: :order).where(orders: { status: [:purchased, :deferred] }) }
59
- scope :deferred, -> { joins(order_items: :order).where(orders: { status: :deferred }) }
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
@@ -4,7 +4,7 @@
4
4
  = link_to 'Change Addresses', effective_orders.edit_order_path(order), rel: :nofollow
5
5
 
6
6
  - unless local_assigns[:skip_order]
7
- = render('/effective/orders/order', order: order, no_order_actions: true)
7
+ = render('/effective/orders/order', order: order)
8
8
 
9
9
  .effective-order-purchase-actions
10
10
  - provider_locals = { order: order, purchased_url: purchased_url, declined_url: declined_url, deferred_url: deferred_url }
@@ -10,7 +10,7 @@
10
10
  - if order.delayed?
11
11
  %p Your #{order.delayed_payment_method} will be charged on #{order.delayed_payment_date.strftime('%F')}
12
12
  - else
13
- %p Waiting for payment by #{order.payment_provider}
13
+ %p Waiting for payment by #{order.payment_provider}.
14
14
 
15
15
  - if order.payment_provider == "etransfer" && (EffectiveOrders.etransfer[:success] rescue false).present?
16
16
  %p= EffectiveOrders.etransfer[:success].html_safe
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '6.16.4'.freeze
2
+ VERSION = '6.17.1'.freeze
3
3
  end
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.16.4
4
+ version: 6.17.1
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-10-11 00:00:00.000000000 Z
11
+ date: 2024-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails