rawgento_models 0.4.0 → 0.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 710008348c4c5890976df958015e7d850a2c430d
4
- data.tar.gz: 62bc8024a6b925f4dd3e275b0744bf44eae5a642
3
+ metadata.gz: 9cc546bbaf1fb83441b5799793dc28d7a863a114
4
+ data.tar.gz: f95499f44eab07c48d14a66898a15d9f91b31d5f
5
5
  SHA512:
6
- metadata.gz: 34a364e2fa30c2f3a9dab5720ea934edc18836c8d3dcbcdeefd78f000ddde17e6c15997688bef5d3f0dc3e742fc96c35ffbf35d8e02d11f1eaea4296f1191539
7
- data.tar.gz: 132d5330d83d6a17c7ebdbe0bae8686cdc330f14ced58295b424b40c5a6eecdd38faa47833625c39ce211d0cd247ac174f76de2ec682f21af685e51c317d3f40
6
+ metadata.gz: a78bfff041e26cc38646bf08e3ef8e4adab9c0d8f7618bcaa215912b9d4ec00322097300a5aaf29a59d764489131d7e91a525e1ffdc478c57cb7f9fe209465e6
7
+ data.tar.gz: c293ef86d8a3e600f050b2289a8672848ec257dc47b658e56812566c0a766b595502f105e7fe185a282de62375da9c7443fcb237c1f167128575d6f0d45d65c4
@@ -0,0 +1,15 @@
1
+ class AddHiddenToLocalProducts < ActiveRecord::Migration
2
+ def change
3
+ rename_column :local_products, :active, :hidden
4
+ change_column_default :local_products, :hidden, false
5
+ change_column_null :local_products, :hidden, false, false
6
+
7
+ add_column :local_products, :active, :boolean, default: true, null: false
8
+
9
+ local_products = RawgentoModels::LocalProduct
10
+ local_products.unscoped.find_each do |p|
11
+ p.hidden = !p.hidden
12
+ p.save!
13
+ end
14
+ end
15
+ end
data/db/schema.rb CHANGED
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 201608081515) do
14
+ ActiveRecord::Schema.define(version: 201608102000) do
15
15
 
16
16
  create_table "local_products", force: :cascade do |t|
17
17
  t.string "name"
@@ -20,12 +20,13 @@ ActiveRecord::Schema.define(version: 201608081515) do
20
20
  t.datetime "updated_at", null: false
21
21
  t.string "shelve_nr"
22
22
  t.integer "packsize"
23
- t.boolean "active", default: true
23
+ t.boolean "hidden", default: true
24
24
  t.integer "supplier_id"
25
25
  t.string "supplier_sku"
26
26
  t.string "supplier_prod_name"
27
27
  t.decimal "purchase_price"
28
28
  t.text "order_info"
29
+ t.boolean "active"
29
30
  end
30
31
 
31
32
  add_index "local_products", ["product_id"], name: "index_local_products_on_product_id", unique: true
@@ -6,7 +6,7 @@ module RawgentoModels
6
6
  has_many :orders, through: :order_items
7
7
  belongs_to :supplier
8
8
 
9
- default_scope { where(active: true).order("name ASC") }
9
+ default_scope { where(active: true, hidden: false).order("name ASC") }
10
10
 
11
11
  scope :linked, -> {
12
12
  joins("LEFT OUTER JOIN " +
@@ -24,7 +24,7 @@ module RawgentoModels
24
24
  scope :supplied_by, ->(supplier) { where(supplier: supplier) }
25
25
 
26
26
  def self.all_hidden
27
- unscoped.where(active: false)
27
+ unscoped.where("active = ? OR hidden = ?", false, true)
28
28
  end
29
29
 
30
30
  def out_of_stock_days_since date
@@ -1,3 +1,3 @@
1
1
  module RawgentoModels
2
- VERSION = "0.4.0".freeze
2
+ VERSION = "0.4.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rawgento_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Wolfsteller
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-09 00:00:00.000000000 Z
11
+ date: 2016-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -116,6 +116,7 @@ files:
116
116
  - db/migrate/201608051145_add_num_stocked_to_order_items.rb
117
117
  - db/migrate/201608081500_add_remote_order_link_to_orders.rb
118
118
  - db/migrate/201608081515_add_order_method_to_orders.rb
119
+ - db/migrate/201608102000_add_hidden_to_local_products.rb
119
120
  - db/schema.rb
120
121
  - exe/rawgento_models
121
122
  - lib/rawgento_models.rb