Skip to content

Commit

Permalink
Merge pull request #18 from vtex-apps/bugfix/nan-price
Browse files Browse the repository at this point in the history
Bugfix/nan price
  • Loading branch information
hiagolcm authored May 7, 2020
2 parents dca5770 + f9e2711 commit 3f8848d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 37 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed
- NaN price in slider.

## [1.1.1] - 2020-05-05

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @vtex-apps/framework-team
* @vtex/search-engagement
49 changes: 29 additions & 20 deletions node/commons/compatibility-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,28 +133,37 @@ const convertSKU = (

export const biggyAttributesToVtexFilters = (attributes: any) =>
attributes.map((attribute: any) => {
const isNumber = attribute.type === 'number'

return {
name: attribute.label,
type:
attribute.type === 'number'
? 'PRICERANGE'
: attribute.type.toUpperCase(),
values: attribute.values.map((value: any) => {
return {
quantity: value.count,
name: unescape(value.label),
key: attribute.key,
value: value.key,
selected: value.active,
range:
attribute.type === 'number'
? {
from: parseFloat(value.from),
to: parseFloat(value.to),
}
: undefined,
}
}),
type: isNumber ? 'PRICERANGE' : attribute.type.toUpperCase(),
values: isNumber
? [
{
quantity: attribute.values.reduce(
(acum: number, value: any) => acum + value.count,
0
),
name: unescape(attribute.label),
key: attribute.key,
value: attribute.key,
selected: attribute.active,
range: {
from: attribute.minValue,
to: attribute.maxValue,
},
},
]
: attribute.values.map((value: any) => {
return {
quantity: value.count,
name: unescape(value.label),
key: attribute.key,
value: value.key,
selected: value.active,
}
}),
}
})

Expand Down
2 changes: 1 addition & 1 deletion node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@types/node": "^12.0.0",
"@types/qs": "^6.5.1",
"@types/ramda": "^0.26.21",
"@vtex/api": "6.27.0",
"@vtex/api": "6.28.1",
"@vtex/tsconfig": "^0.2.0",
"eslint": "^5.15.3",
"eslint-config-vtex": "^10.1.0",
Expand Down
25 changes: 10 additions & 15 deletions node/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -777,10 +777,10 @@
lodash.unescape "4.0.1"
semver "5.5.0"

"@vtex/api@6.27.0":
version "6.27.0"
resolved "https://registry.yarnpkg.com/@vtex/api/-/api-6.27.0.tgz#c19634181915363bc9fa9e1150c5c15aa4b3f25e"
integrity sha512-yNkEbjSvKnC2VSAypYK5WaGW/tKmDgvO4kNaI8ZKU5anG3U82QjWWYlqsFZXh0ycvlP9l4+Og2BMHat4YKy+uA==
"@vtex/api@6.28.1":
version "6.28.1"
resolved "https://registry.yarnpkg.com/@vtex/api/-/api-6.28.1.tgz#36ae0535bde187f0bf84c69d41bf30f3c38f5ea6"
integrity sha512-9lpRwHPPXsyrbwkgbFgMp5/ENvaqS5TVJ7VtOXtRo5HjjEKrRCRO2vhPnocCDYj0O1Msk41Awj30HMZ5MpblFw==
dependencies:
"@types/koa" "^2.11.0"
"@types/koa-compose" "^3.2.3"
Expand All @@ -800,7 +800,7 @@
graphql "^14.5.8"
graphql-tools "^4.0.6"
graphql-upload "^8.1.0"
jaeger-client "^3.17.2"
jaeger-client "^3.18.0"
js-base64 "^2.5.1"
koa "^2.11.0"
koa-compose "^4.1.0"
Expand Down Expand Up @@ -2989,13 +2989,13 @@ iterall@^1.1.3, iterall@^1.2.2:
resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.2.2.tgz#92d70deb8028e0c39ff3164fdbf4d8b088130cd7"
integrity sha512-yynBb1g+RFUPY64fTrFv7nsjRrENBQJaX2UL+2Szc9REFrSNm1rpSXHGzhmAy7a9uv3vlvgBlXnf9RqmPH1/DA==

jaeger-client@^3.17.2:
version "3.17.2"
resolved "https://registry.yarnpkg.com/jaeger-client/-/jaeger-client-3.17.2.tgz#92cf26752c5c66f3e66adf595cdde2f548cc0804"
integrity sha512-19YloSidmKbrXHgecLWod8eXo7rm2ieUnsfg0ripTFGRCW5v2OWE96Gte4/tOQG/8N+T39VoLU2nMBdjbdMUJg==
jaeger-client@^3.18.0:
version "3.18.0"
resolved "https://registry.yarnpkg.com/jaeger-client/-/jaeger-client-3.18.0.tgz#95c9183e06a9b14b957bce33b5e2ddaecb2ed51f"
integrity sha512-xZ9WvZDWLkZFq7SObpLwu1asMCKCgBRNcDxxGSvK+ZQ7OZyJC5xPlU+rJa4+s/P6autPBVwHpqMGbOERFxWuuA==
dependencies:
node-int64 "^0.4.0"
opentracing "^0.13.0"
opentracing "^0.14.4"
thriftrw "^3.5.0"
uuid "^3.2.1"
xorshift "^0.2.0"
Expand Down Expand Up @@ -4064,11 +4064,6 @@ only@~0.0.2:
resolved "https://registry.yarnpkg.com/only/-/only-0.0.2.tgz#2afde84d03e50b9a8edc444e30610a70295edfb4"
integrity sha1-Kv3oTQPlC5qO3EROMGEKcCle37Q=

opentracing@^0.13.0:
version "0.13.0"
resolved "https://registry.yarnpkg.com/opentracing/-/opentracing-0.13.0.tgz#6a341442f09d7d866bc11ed03de1e3828e3d6aab"
integrity sha1-ajQUQvCdfYZrwR7QPeHjgo49aqs=

opentracing@^0.14.4:
version "0.14.4"
resolved "https://registry.yarnpkg.com/opentracing/-/opentracing-0.14.4.tgz#a113408ea740da3a90fde5b3b0011a375c2e4268"
Expand Down

0 comments on commit 3f8848d

Please sign in to comment.