rawgento_models 0.4.2 → 0.4.3
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/db/migrate/2016023081730_add_state_dates_to_orders.rb +7 -0
- data/db/migrate/201608241200_add_organic_field_to_local_products.rb +6 -0
- data/db/schema.rb +3 -1
- data/lib/rawgento_models/local_product.rb +8 -0
- data/lib/rawgento_models/order_item.rb +1 -0
- data/lib/rawgento_models/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4814ee723f18c8dfa1ec4312473041be4ddfd7cf
|
4
|
+
data.tar.gz: 358140c9c7961c317c41577a19eae31445f72f4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af0e2bd243026e407473203dc3796d2aee3b73b309f869f6ee85efeff2a159d088fb031588cde6b33d4402b48ce165ca57b1a1b37516121e96c1785b3a0c2714
|
7
|
+
data.tar.gz: 4a749841d4f3554d19876e84ae0e7495ea83bc08fb39dd7cefdd27ea992b0415375871e966f145f972684fbe547a52a36f74fb4141e5b0043e79ed298e57621e
|
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:
|
14
|
+
ActiveRecord::Schema.define(version: 2016023081730) do
|
15
15
|
|
16
16
|
create_table "local_products", force: :cascade do |t|
|
17
17
|
t.string "name"
|
@@ -59,6 +59,8 @@ ActiveRecord::Schema.define(version: 201608190700) do
|
|
59
59
|
t.string "remote_order_id"
|
60
60
|
t.string "remote_order_link"
|
61
61
|
t.string "order_method"
|
62
|
+
t.datetime "ordered_at"
|
63
|
+
t.datetime "stocked_at"
|
62
64
|
end
|
63
65
|
|
64
66
|
add_index "orders", ["supplier_id"], name: "index_orders_on_supplier_id"
|
@@ -35,6 +35,14 @@ module RawgentoModels
|
|
35
35
|
stock_items.order(created_at: :asc).first
|
36
36
|
end
|
37
37
|
|
38
|
+
def days_since_first_stock
|
39
|
+
if first_record = first_stock_record
|
40
|
+
(Date.today - first_record.created_at.to_date)
|
41
|
+
else
|
42
|
+
0
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
38
46
|
def link_suggestions limit=10
|
39
47
|
guesses = []
|
40
48
|
guesses << RemoteProduct.supplied_by(self.supplier).where(name: self.name).to_a
|
@@ -8,6 +8,7 @@ module RawgentoModels
|
|
8
8
|
scope :processible, -> { where("num_wished > 0") }
|
9
9
|
# Actually its more like 'has been put in cart'
|
10
10
|
scope :ordered, -> { where("num_ordered > 0") }
|
11
|
+
scope :stocked, -> { where("num_stocked > 0") }
|
11
12
|
|
12
13
|
def remote_product_id
|
13
14
|
local_product.remote_product.try(: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.4.
|
4
|
+
version: 0.4.3
|
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-
|
11
|
+
date: 2016-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- db/migrate/201602151400_create_supplier.rb
|
104
104
|
- db/migrate/201602151420_change_supplier_columns.rb
|
105
105
|
- db/migrate/201602151430_link_supplier.rb
|
106
|
+
- db/migrate/2016023081730_add_state_dates_to_orders.rb
|
106
107
|
- db/migrate/201605270920_change_local_product_shelve_column.rb
|
107
108
|
- db/migrate/201605291700_add_email_and_order_template_to_supplier.rb
|
108
109
|
- db/migrate/201605291800_add_supplier_to_order.rb
|
@@ -118,6 +119,7 @@ files:
|
|
118
119
|
- db/migrate/201608081515_add_order_method_to_orders.rb
|
119
120
|
- db/migrate/201608102000_add_hidden_to_local_products.rb
|
120
121
|
- db/migrate/201608190700_add_index_to_order_items.rb
|
122
|
+
- db/migrate/201608241200_add_organic_field_to_local_products.rb
|
121
123
|
- db/schema.rb
|
122
124
|
- exe/rawgento_models
|
123
125
|
- lib/rawgento_models.rb
|