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 +4 -4
- data/app/controllers/comee/core/customer_order_items_controller.rb +0 -1
- data/app/controllers/comee/core/sales_order_items_controller.rb +1 -1
- data/app/models/comee/core/customer_order_item.rb +2 -0
- data/app/models/comee/core/sales_order.rb +2 -1
- data/app/models/comee/core/sales_order_item.rb +2 -0
- data/app/services/comee/core/customer_order_service.rb +8 -0
- data/lib/comee/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f908a911b1098420945879d34cfcea3d9d2621d45558a771fc00523f90f5c9f
|
4
|
+
data.tar.gz: a5a0ba0c43e01acd881f85a99ac0913ce87863ead8528dc313095874e0af435d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ecbb6029fd90d1238167c0d9f25e855bbe4564e444f5265c9fad5419d68cf42106bc9cebf9ed6ad1b378716bd44a8c7d2205a8c930512553b962d7d2b6227dd
|
7
|
+
data.tar.gz: 7a1532959dd4b0f75c9ede644ba2b5d8f2179328c7d6f4bce434a4e194e76062efe835f9c7824f1c6353b05dab7dee065df3610e82c50a8b52d6a1b11152c767
|
@@ -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
|
data/lib/comee/core/version.rb
CHANGED
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.
|
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-
|
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
|