comee_core 0.1.97 → 0.1.99
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/comee/core/master_price.rb +1 -1
- data/app/models/comee/core/price.rb +2 -1
- data/db/migrate/20230813235946_create_comee_core_master_prices.rb +2 -2
- data/db/migrate/20230814151601_create_comee_core_client_prices.rb +2 -1
- data/lib/comee/core/version.rb +1 -1
- data/spec/factories/comee/core/client_prices.rb +1 -1
- data/spec/factories/comee/core/master_prices.rb +6 -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: f3b5b69ffae3e2702ed23106fbc360890ec375ae49c97a136b98baad2fec89d8
|
4
|
+
data.tar.gz: 5fc14c0bac612232d3d32bf4c2f1f0e98e75773adb2aa343d1b73387f8b92bac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 986aff6f5d73b35a540a16fbbdafc62a2c03911a6cd06430de431fa30f547994ec3038d90d38e37a8504f36547cb3f519f9804cc8828a54942b08b49752d2884
|
7
|
+
data.tar.gz: c4add758cc2d3c861a10b0c584f96abac453928bacd0ad5375150bc56233323d4c95a0aa5f617cfe036884efad323b900c39dc6579ae4baaa6fa7d4c0c3fd3a4
|
@@ -7,7 +7,7 @@ module Comee
|
|
7
7
|
belongs_to :next_price, class_name: "Comee::Core::MasterPrice", optional: true
|
8
8
|
belongs_to :product_lookup, optional: true
|
9
9
|
|
10
|
-
validates :
|
10
|
+
validates :purchase_price, :selling_price, presence: true
|
11
11
|
validates :margin, presence: true, numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 100}
|
12
12
|
validates :product_id, uniqueness: {scope: %i[supplier_id previous_price_id next_price_id status]}
|
13
13
|
validate :validate_primary_price, :validate_product_lookup
|
@@ -5,6 +5,7 @@ module Comee
|
|
5
5
|
before_save :compute_status
|
6
6
|
|
7
7
|
enum :status, {past: 0, current: 1, future: 2}
|
8
|
+
enum :price_status, {draft: 0, approved: 1}
|
8
9
|
|
9
10
|
scope :current, -> { where(status: Price.statuses[:current]) }
|
10
11
|
scope :future, -> { where(status: Price.statuses[:future]) }
|
@@ -12,7 +13,7 @@ module Comee
|
|
12
13
|
belongs_to :product
|
13
14
|
belongs_to :unit
|
14
15
|
|
15
|
-
validates :valid_from, :valid_to, presence: true
|
16
|
+
validates :price_status, :valid_from, :valid_to, presence: true
|
16
17
|
validate :validate_price_validity_dates
|
17
18
|
|
18
19
|
def validate_price_validity_dates
|
@@ -5,11 +5,11 @@ class CreateComeeCoreMasterPrices < ActiveRecord::Migration[7.0]
|
|
5
5
|
t.float :selling_price, null: false
|
6
6
|
t.date :valid_from, null: false
|
7
7
|
t.date :valid_to, null: false
|
8
|
-
t.
|
8
|
+
t.integer :status, null: false, default: 0
|
9
|
+
t.integer :price_status, null: false, default: 0
|
9
10
|
t.boolean :primary, null: false, default: false
|
10
11
|
t.float :margin, null: false, default: 0
|
11
12
|
t.integer :lead_time
|
12
|
-
t.integer :price_status, null: false, default: 0
|
13
13
|
t.references :product,
|
14
14
|
null: false,
|
15
15
|
index: {name: "product_on_ccmp_indx"},
|
@@ -4,7 +4,8 @@ class CreateComeeCoreClientPrices < ActiveRecord::Migration[7.0]
|
|
4
4
|
t.date :valid_from, null: false
|
5
5
|
t.date :valid_to, null: false
|
6
6
|
t.float :price, null: false
|
7
|
-
t.
|
7
|
+
t.integer :status, null: false, default: 0
|
8
|
+
t.integer :price_status, null: false, default: 0
|
8
9
|
t.float :margin, null: false, default: 0
|
9
10
|
t.integer :margin_type, null: false, default: 0
|
10
11
|
t.references :product,
|
data/lib/comee/core/version.rb
CHANGED
@@ -2,7 +2,7 @@ FactoryBot.define do
|
|
2
2
|
factory :client_price, class: "Comee::Core::ClientPrice" do
|
3
3
|
valid_from { Date.current.advance(months: -1) }
|
4
4
|
valid_to { Date.current.advance(months: 1) }
|
5
|
-
|
5
|
+
price_status { Comee::Core::Price.price_statuses[:draft] }
|
6
6
|
price { 100 }
|
7
7
|
product
|
8
8
|
client
|
@@ -7,7 +7,7 @@ FactoryBot.define do
|
|
7
7
|
primary { false }
|
8
8
|
margin { 10.0 }
|
9
9
|
lead_time { nil }
|
10
|
-
|
10
|
+
price_status { Comee::Core::Price.price_statuses[:draft] }
|
11
11
|
product
|
12
12
|
supplier
|
13
13
|
unit
|
@@ -16,6 +16,10 @@ FactoryBot.define do
|
|
16
16
|
product_lookup { nil }
|
17
17
|
propagated_to_client { false }
|
18
18
|
|
19
|
+
trait :approved do
|
20
|
+
price_status { Comee::Core::Price.price_statuses[:approved] }
|
21
|
+
end
|
22
|
+
|
19
23
|
trait :past do
|
20
24
|
valid_from { Date.current.advance(months: -2) }
|
21
25
|
valid_to { Date.current.advance(months: -1) }
|
@@ -60,6 +64,7 @@ FactoryBot.define do
|
|
60
64
|
previous_price: price
|
61
65
|
)
|
62
66
|
price.next_price = next_price
|
67
|
+
price.price_status = Comee::Core::Price.price_statuses[:approved]
|
63
68
|
price.save!
|
64
69
|
price
|
65
70
|
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.1.
|
4
|
+
version: 0.1.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-01-
|
11
|
+
date: 2024-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|