rawgento_db 0.2.5 → 0.2.6
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 +6 -0
- data/lib/rawgento_db/query.rb +5 -2
- data/lib/rawgento_db/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2f39b606713108b79c79caa29f5224c52319d9b5
|
|
4
|
+
data.tar.gz: a31ff5c1c3daed526632ce61ceee4ed559f0cfed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d256a8127cadda9801c6138e681357a839aa95a1ee1b6a67309a87fd43f1fb5f8d68691410f468ed991ef05db98e57bdf1468aa88bfc959960af143ddfd4f862
|
|
7
|
+
data.tar.gz: 141b20254355411af8231aae27cb4a46c15af968b344e178720e14fe208502e5afea5e25d932230f672f543ef66980851516864195ed64e3c269c9f120db75c8
|
data/README.md
CHANGED
|
@@ -59,6 +59,12 @@ After checking out the repo, run `bin/setup` to install dependencies. You can al
|
|
|
59
59
|
|
|
60
60
|
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).
|
|
61
61
|
|
|
62
|
+
### How to find magento attribute names and values
|
|
63
|
+
|
|
64
|
+
Some Attribute names/ids are found like this: `SELECT * FROM magentodb.eav_attribute_label;`
|
|
65
|
+
|
|
66
|
+
Most Attribute names/ids are found like this: `SELECT * FROM magentodb.eav_attribute;`
|
|
67
|
+
|
|
62
68
|
## Contributing
|
|
63
69
|
|
|
64
70
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rawgento_db. 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/lib/rawgento_db/query.rb
CHANGED
|
@@ -78,6 +78,7 @@ module RawgentoDB
|
|
|
78
78
|
query = 'SELECT * '\
|
|
79
79
|
'FROM sales_bestsellers_aggregated_daily '\
|
|
80
80
|
'WHERE product_id = %d AND '\
|
|
81
|
+
'store_id = 1 AND '\
|
|
81
82
|
'period >= \'%s\' AND period <= \'%s\' '\
|
|
82
83
|
'ORDER BY PERIOD DESC' % [product_id, min_date.strftime, max_date.strftime]
|
|
83
84
|
result = client(settings).query(query)
|
|
@@ -91,6 +92,7 @@ module RawgentoDB
|
|
|
91
92
|
query = 'SELECT DISTINCT * '\
|
|
92
93
|
'FROM sales_bestsellers_aggregated_monthly '\
|
|
93
94
|
'WHERE product_id = %d AND '\
|
|
95
|
+
'store_id = 1 AND '\
|
|
94
96
|
'period >= \'%s\' AND period <= \'%s\' '\
|
|
95
97
|
'ORDER BY period DESC' % [product_id, min_date.strftime, max_date.strftime]
|
|
96
98
|
result = client(settings).query(query)
|
|
@@ -121,7 +123,7 @@ module RawgentoDB
|
|
|
121
123
|
query = "SELECT MIN(period), product_id "\
|
|
122
124
|
"FROM sales_bestsellers_aggregated_daily "\
|
|
123
125
|
"WHERE product_id in (%s) "\
|
|
124
|
-
"GROUP BY product_id" % [product_ids.join(",")]
|
|
126
|
+
"GROUP BY product_id" % [[*product_ids].join(",")]
|
|
125
127
|
result = client(settings).query(query)
|
|
126
128
|
result.map do |r|
|
|
127
129
|
[r['product_id'], r['MIN(period)']]
|
|
@@ -133,7 +135,8 @@ module RawgentoDB
|
|
|
133
135
|
"FROM sales_bestsellers_aggregated_daily "\
|
|
134
136
|
"WHERE product_id in (%s) "\
|
|
135
137
|
" AND period >= '%s' "\
|
|
136
|
-
"
|
|
138
|
+
" AND store_id = 1 "\
|
|
139
|
+
"GROUP BY product_id" % [[*product_ids].join(","), day.strftime]
|
|
137
140
|
|
|
138
141
|
result = client(settings).query(query)
|
|
139
142
|
result.map do |r|
|
data/lib/rawgento_db/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rawgento_db
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.6
|
|
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-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rawgento_models
|