comee_core 0.1.97 → 0.1.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b02327a6f7076613d6072fc19df00c3c19b8256dfba0e90d254d4c63f21cd87
|
4
|
+
data.tar.gz: eab3d691391e6aa77b95074449704f65f2b7320f3a920b00ef645b651351bec4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb5963d8249beac05dc28de793a53c970168f0da7f20f289e0bbb2c81562b633e85be1eb77befe79f268535b3b23174fda847b15e940e21575f1fd0502de977a
|
7
|
+
data.tar.gz: c5ceac445d220ed100a80ce759f62ac5537bb862e357dfb855552b49aa5b94880163baaae8f371a16f96db07d30491d92fa04043420c9f4084154e5f34003904
|
@@ -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
|