comee_core 0.1.97 → 0.1.98

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: 0cb92df3470f8c017719aaedbe6c51315760869a45a018f2c551a8d069d0f815
4
- data.tar.gz: d981a86bc337820f64b63b8f4e5d95d44482f772ff8f222b276f5f4b56ff6190
3
+ metadata.gz: 7b02327a6f7076613d6072fc19df00c3c19b8256dfba0e90d254d4c63f21cd87
4
+ data.tar.gz: eab3d691391e6aa77b95074449704f65f2b7320f3a920b00ef645b651351bec4
5
5
  SHA512:
6
- metadata.gz: bb572acac1f0630247da9380f43d22edc32c289e3cdf998b91517f37eec10a9cd01edbf122e9183e0c5d8b61a2a04630d2a6fac679fad53e6ae9212541f2a590
7
- data.tar.gz: 76d0cf07ad78fccd24d09a9eb8db389e3a8c10801e0cd2898fe958918a99f0861e557d7185703b79bfbd3b18adaf858511fa3973b70991617dee3e481794cb2b
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 :price_status, :purchase_price, :selling_price, presence: true
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.float :status, null: false, default: 0
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.float :status, null: false, default: 0
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,
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.1.97".freeze
3
+ VERSION = "0.1.98".freeze
4
4
  end
5
5
  end
@@ -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
- status { 0 }
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
- status { Comee::Core::MasterPrice.statuses[:draft] }
10
+ price_status { Comee::Core::Price.price_statuses[:draft] }
11
11
  product
12
12
  supplier
13
13
  unit
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comee_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.97
4
+ version: 0.1.98
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.