effective_qb_sync 1.3.6 → 1.3.7

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: 7661088e53e1d6c02bb8ce7ae766d2253e742cee52900ff1f88b5dda913cc81d
4
- data.tar.gz: 9d34f24a3e7d7765012f38476771ce3ff5ef9767349e63e2c74e544be50fe1a9
3
+ metadata.gz: 5e1b10dc71838c8390bd6baff5fa2bcec970c0be67d3a799967b17cbb1e8490d
4
+ data.tar.gz: 38cea0b7beb53c3ebfcddda052ea3970514a3c9bfbc4d31d17b9e27194f0db26
5
5
  SHA512:
6
- metadata.gz: a939efae8b650ac173d0b7f5adaca44d6c23f2183faafae00df54775699744fe49db531393daf08f144a598879de956bc92c84076d666e13ccf48a5514a1fa02
7
- data.tar.gz: 58cb299e4125fce20c337e25aa0e7339622f29ab1471caca5553c2be1bf135347ba711955f89aceebe8fd96ab5e091717e172732f82c519d55f1fec9d35c0532
6
+ metadata.gz: 653e25f22cd61bac1119dc50cf0abbc29109906ee8de741db7c75527f60db2f5278567d18a9e3fa70df376a042672487ddfeec0d262e6fbe0ed088367a212464
7
+ data.tar.gz: '019270eb08c5b8267676b7f94d01ae15150a7c3f34d643aa762a0c726833d5192a5ba791a352d550571d73d3510756c8d4eee6d6e79fe1526776473e5e66df3d'
@@ -52,7 +52,7 @@ module Admin
52
52
  def set_all_orders_finished
53
53
  Effective::QbTicket.transaction do
54
54
  begin
55
- Effective::QbTicket.set_all_orders_finished!
55
+ Effective::QbTicket.set_orders_finished!
56
56
 
57
57
  flash[:success] = 'Successfully set all orders finished'
58
58
  rescue => e
@@ -30,7 +30,7 @@ module Effective
30
30
 
31
31
  # creates (does not persist) QbRequests for outstanding orders. The caller may choose to
32
32
  # persist a request when that request starts communicating with QuickBooks
33
- def self.new_requests_for_unsynced_items(before: nil)
33
+ def self.new_requests_for_unsynced_items(before: nil, order_ids: nil)
34
34
  finished_order_ids = Effective::QbRequest.where(state: 'Finished').pluck(:order_id)
35
35
  finished_orders = Effective::Order.purchased.includes(order_items: [:purchasable, :qb_order_item]).where.not(id: finished_order_ids)
36
36
 
@@ -39,6 +39,10 @@ module Effective
39
39
  finished_orders = finished_orders.where('purchased_at < ?', before)
40
40
  end
41
41
 
42
+ if order_ids.present?
43
+ finished_orders = finished_orders.where(id: order_ids)
44
+ end
45
+
42
46
  finished_orders.map { |order| Effective::QbRequest.new(order: order) }
43
47
  end
44
48
 
@@ -30,12 +30,12 @@ module Effective
30
30
 
31
31
  validates :state, inclusion: { in: STATES }
32
32
 
33
- def self.set_all_orders_finished!(before: nil)
33
+ def self.set_orders_finished!(before: nil, order_ids: nil)
34
34
  qb_ticket = Effective::QbTicket.new(state: 'Finished')
35
35
  qb_ticket.qb_logs.build(message: 'Set all orders Finished')
36
36
  qb_ticket.save!
37
37
 
38
- Effective::QbRequest.new_requests_for_unsynced_items(before: before).each do |qb_request|
38
+ Effective::QbRequest.new_requests_for_unsynced_items(before: before, order_ids: order_ids).each do |qb_request|
39
39
  qb_request.qb_ticket = qb_ticket
40
40
  qb_request.transition_to_finished
41
41
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveQbSync
2
- VERSION = '1.3.6'.freeze
2
+ VERSION = '1.3.7'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_qb_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.6
4
+ version: 1.3.7
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: 2022-01-11 00:00:00.000000000 Z
11
+ date: 2022-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails