comee_core 0.2.97 → 0.2.99

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: 5c8e51d4338bca0293010bb351722f44c8f2f653eb8afe8aca1b9abf152b2f98
4
- data.tar.gz: b11f9d292f843c1798812e9f8fdf9447f13c34b6543f1f4c2d4d30e7bff413bb
3
+ metadata.gz: 6f908a911b1098420945879d34cfcea3d9d2621d45558a771fc00523f90f5c9f
4
+ data.tar.gz: a5a0ba0c43e01acd881f85a99ac0913ce87863ead8528dc313095874e0af435d
5
5
  SHA512:
6
- metadata.gz: 04d1973d5085f0961d4c47f569eeebdb7b7aea89f1c6b65c926095b027f9da10251bd77fbef14883bf8f681a25e12de5bf1938d75f8e22c64af6999d1a47ae1c
7
- data.tar.gz: b211b69a816ece7e4354e9e81f643683d9f3b491041b404838e89d2f5730ac8d3744f07edc3c70f6915ec6cb347da77e2a4e58dc0c2313d0e19e66cc6109fda2
6
+ metadata.gz: 2ecbb6029fd90d1238167c0d9f25e855bbe4564e444f5265c9fad5419d68cf42106bc9cebf9ed6ad1b378716bd44a8c7d2205a8c930512553b962d7d2b6227dd
7
+ data.tar.gz: 7a1532959dd4b0f75c9ede644ba2b5d8f2179328c7d6f4bce434a4e194e76062efe835f9c7824f1c6353b05dab7dee065df3610e82c50a8b52d6a1b11152c767
@@ -21,7 +21,6 @@ module Comee
21
21
  data = CustomerOrderItem.includes(:product, :unit)
22
22
  .ransack(params[:q])
23
23
  .result
24
- .order(:serial_no)
25
24
  render_content(data, {include: ["unit"]})
26
25
  end
27
26
 
@@ -23,7 +23,7 @@ module Comee
23
23
  :source,
24
24
  :product,
25
25
  :unit
26
- ).ransack(params[:q]).result.order(:serial_no)
26
+ ).ransack(params[:q]).result
27
27
  render_content(data)
28
28
  end
29
29
 
@@ -1,6 +1,8 @@
1
1
  module Comee
2
2
  module Core
3
3
  class CustomerOrderItem < ApplicationRecord
4
+ default_scope { order(serial_no: :asc) }
5
+
4
6
  before_save :calculate_total_price
5
7
 
6
8
  belongs_to :customer_order
@@ -40,12 +40,13 @@ module Comee
40
40
  order_number
41
41
  status
42
42
  purchase_status
43
+ consignee
43
44
  customer_order_id
44
45
  ]
45
46
  end
46
47
 
47
48
  def self.ransackable_associations(_auth_object = nil)
48
- ["client"]
49
+ %w[client customer_order]
49
50
  end
50
51
 
51
52
  def files_url
@@ -1,6 +1,8 @@
1
1
  module Comee
2
2
  module Core
3
3
  class SalesOrderItem < ApplicationRecord
4
+ default_scope { order(serial_no: :asc) }
5
+
4
6
  before_save :calculate_total_price
5
7
  before_save :calculate_handover_date
6
8
  after_save :update_sales_order_purchase_status, if: proc { |item| item.fully_processed? }
@@ -2,6 +2,14 @@ module Comee
2
2
  module Core
3
3
  class CustomerOrderService
4
4
  def create(params)
5
+ ActiveRecord::Base.transaction do
6
+ prev_order = Comee::Core::CustomerOrder.find_by(order_number: params[:order_number])
7
+
8
+ if prev_order && Comee::Core::CustomerOrderItem.exists?(customer_order_id: prev_order.id)
9
+ Comee::Core::CustomerOrderItem.where(customer_order_id: prev_order.id).delete_all
10
+ prev_order.delete
11
+ end
12
+ end
5
13
  order = nil
6
14
  params = params.to_h.with_indifferent_access
7
15
  ActiveRecord::Base.transaction do
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.2.97".freeze
3
+ VERSION = "0.2.99".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comee_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.97
4
+ version: 0.2.99
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-16 00:00:00.000000000 Z
11
+ date: 2024-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers