rawgento_models 0.2.4 → 0.2.5
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/README.md +4 -0
- data/db/migrate/201608011400_extend_supplier_fields.rb +8 -0
- data/db/migrate/201608011700_add_purchase_price_to_local_product.rb +5 -0
- data/db/migrate/201608011715_add_order_info_to_local_product.rb +5 -0
- data/db/schema.rb +37 -14
- data/lib/rawgento_models/order.rb +1 -0
- data/lib/rawgento_models/order_item.rb +8 -0
- data/lib/rawgento_models/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e08eb86f68a89d3a006545f7326ada10cee3999
|
4
|
+
data.tar.gz: f99866f97f2e411f2533683db6ce969cc7701206
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9ae1e4bb020ea103c3e7081d209bd3e2b94df50ccfae0282d64a0ea37dbc05412a8d86758310bd6fcbefdf6cefa77340a3d7453dc4262a87115e1bc53e001ad
|
7
|
+
data.tar.gz: fe99dc99208c008ebc66727d25b3b25c2f4ee6a6473bfcbd9ea447772974c4d89d8e2372b32ad24b327ec5924dabdf6830f3e3a7864cd73fd31277475289a0fa
|
data/README.md
CHANGED
@@ -64,6 +64,10 @@ After checking out the repo, run `bin/setup` to install dependencies. You can al
|
|
64
64
|
|
65
65
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
66
66
|
|
67
|
+
### Create new migrations
|
68
|
+
|
69
|
+
Its easiest to copy an existing migration (from db/migrate), adjust the timestamp in the file name and replace the actual migration code.
|
70
|
+
|
67
71
|
## Contributing
|
68
72
|
|
69
73
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rawgento_models. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
data/db/schema.rb
CHANGED
@@ -11,28 +11,33 @@
|
|
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:
|
14
|
+
ActiveRecord::Schema.define(version: 201608011715) do
|
15
15
|
|
16
16
|
create_table "local_products", force: :cascade do |t|
|
17
17
|
t.string "name"
|
18
|
-
t.string "supplier"
|
19
18
|
t.integer "product_id"
|
20
|
-
t.datetime "created_at",
|
21
|
-
t.datetime "updated_at",
|
22
|
-
t.
|
19
|
+
t.datetime "created_at", null: false
|
20
|
+
t.datetime "updated_at", null: false
|
21
|
+
t.string "shelve_nr"
|
23
22
|
t.integer "packsize"
|
24
|
-
t.boolean "active",
|
23
|
+
t.boolean "active", default: true
|
24
|
+
t.integer "supplier_id"
|
25
|
+
t.string "supplier_sku"
|
26
|
+
t.string "supplier_prod_name"
|
27
|
+
t.decimal "purchase_price"
|
28
|
+
t.text "order_info"
|
25
29
|
end
|
26
30
|
|
27
31
|
add_index "local_products", ["product_id"], name: "index_local_products_on_product_id", unique: true
|
32
|
+
add_index "local_products", ["supplier_id"], name: "index_local_products_on_supplier_id"
|
28
33
|
|
29
34
|
create_table "order_items", force: :cascade do |t|
|
30
|
-
t.integer "order_id",
|
31
|
-
t.string "state"
|
35
|
+
t.integer "order_id", null: false
|
36
|
+
t.string "state", default: "new"
|
32
37
|
t.integer "num_wished"
|
33
38
|
t.integer "num_ordered"
|
34
|
-
t.datetime "created_at",
|
35
|
-
t.datetime "updated_at",
|
39
|
+
t.datetime "created_at", null: false
|
40
|
+
t.datetime "updated_at", null: false
|
36
41
|
t.integer "local_product_id"
|
37
42
|
t.integer "current_stock"
|
38
43
|
t.integer "min_stock"
|
@@ -41,21 +46,25 @@ ActiveRecord::Schema.define(version: 201601251100) do
|
|
41
46
|
add_index "order_items", ["local_product_id"], name: "index_order_items_on_local_product_id"
|
42
47
|
|
43
48
|
create_table "orders", force: :cascade do |t|
|
44
|
-
t.string "state"
|
45
|
-
t.datetime "created_at",
|
46
|
-
t.datetime "updated_at",
|
49
|
+
t.string "state", default: "new"
|
50
|
+
t.datetime "created_at", null: false
|
51
|
+
t.datetime "updated_at", null: false
|
52
|
+
t.integer "supplier_id"
|
47
53
|
end
|
48
54
|
|
55
|
+
add_index "orders", ["supplier_id"], name: "index_orders_on_supplier_id"
|
56
|
+
|
49
57
|
create_table "remote_products", force: :cascade do |t|
|
50
58
|
t.string "name"
|
51
|
-
t.string "supplier"
|
52
59
|
t.integer "local_product_id"
|
53
60
|
t.integer "product_id"
|
54
61
|
t.datetime "created_at", null: false
|
55
62
|
t.datetime "updated_at", null: false
|
63
|
+
t.integer "supplier_id"
|
56
64
|
end
|
57
65
|
|
58
66
|
add_index "remote_products", ["local_product_id"], name: "index_remote_products_on_local_product_id"
|
67
|
+
add_index "remote_products", ["supplier_id"], name: "index_remote_products_on_supplier_id"
|
59
68
|
|
60
69
|
create_table "stock_items", force: :cascade do |t|
|
61
70
|
t.integer "local_product_id"
|
@@ -67,4 +76,18 @@ ActiveRecord::Schema.define(version: 201601251100) do
|
|
67
76
|
|
68
77
|
add_index "stock_items", ["local_product_id"], name: "index_stock_items_on_local_product_id"
|
69
78
|
|
79
|
+
create_table "suppliers", force: :cascade do |t|
|
80
|
+
t.string "name"
|
81
|
+
t.boolean "remote_shop", default: false
|
82
|
+
t.datetime "created_at", null: false
|
83
|
+
t.datetime "updated_at", null: false
|
84
|
+
t.string "email"
|
85
|
+
t.text "order_template"
|
86
|
+
t.integer "delivery_time_days"
|
87
|
+
t.text "order_info"
|
88
|
+
t.decimal "minimum_order_value"
|
89
|
+
end
|
90
|
+
|
91
|
+
add_index "suppliers", ["name"], name: "index_suppliers_on_name"
|
92
|
+
|
70
93
|
end
|
@@ -21,6 +21,14 @@ module RawgentoModels
|
|
21
21
|
num_ordered == 0
|
22
22
|
end
|
23
23
|
|
24
|
+
def ordered?
|
25
|
+
!not_ordered?
|
26
|
+
end
|
27
|
+
|
28
|
+
def not_ordered?
|
29
|
+
num_ordered.nil?
|
30
|
+
end
|
31
|
+
|
24
32
|
def order_item_same_product before
|
25
33
|
time_range = Date.civil(1970, 1, 1)..before
|
26
34
|
OrderItem.where(local_product_id: self.local_product_id)
|
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.2.
|
4
|
+
version: 0.2.5
|
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-
|
11
|
+
date: 2016-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -107,6 +107,9 @@ files:
|
|
107
107
|
- db/migrate/201605291700_add_email_and_order_template_to_supplier.rb
|
108
108
|
- db/migrate/201605291800_add_supplier_to_order.rb
|
109
109
|
- db/migrate/201607111745_add_supplier_attributes_to_local_product.rb
|
110
|
+
- db/migrate/201608011400_extend_supplier_fields.rb
|
111
|
+
- db/migrate/201608011700_add_purchase_price_to_local_product.rb
|
112
|
+
- db/migrate/201608011715_add_order_info_to_local_product.rb
|
110
113
|
- db/schema.rb
|
111
114
|
- exe/rawgento_models
|
112
115
|
- lib/rawgento_models.rb
|