Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core-database): properly sort BigNumber values #2144

Merged
merged 13 commits into from
Feb 25, 2019
Merged

fix(core-database): properly sort BigNumber values #2144

merged 13 commits into from
Feb 25, 2019

Conversation

faustbrian
Copy link
Contributor

Proposed changes

BigNumber values were sorted but resulted in an odd order.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)

Checklist

  • I have read the CONTRIBUTING documentation
  • Lint and unit tests pass locally with my changes

@ghost
Copy link

ghost commented Feb 23, 2019

@air1one @supaiku0 - please review this in the next few days. Be sure to explicitly select labels so I know what's going on.

If no reviewer appears after a week, a reminder will be sent out.

@ghost ghost requested a review from air1one February 23, 2019 08:33
@ghost
Copy link

ghost commented Feb 23, 2019

@faustbrian The ci/circleci: test-node11-0 job is failing as of 7c0ad74a7d6827cb26ce41914d6081b6afb6ef2a. Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@codecov-io
Copy link

codecov-io commented Feb 23, 2019

Codecov Report

Merging #2144 into develop will decrease coverage by 0.01%.
The diff coverage is 73.91%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2144      +/-   ##
===========================================
- Coverage    79.48%   79.47%   -0.02%     
===========================================
  Files          330      331       +1     
  Lines         7913     7922       +9     
  Branches      1099     1115      +16     
===========================================
+ Hits          6290     6296       +6     
- Misses        1590     1593       +3     
  Partials        33       33
Impacted Files Coverage Δ
packages/core-database/src/repositories/wallets.ts 100% <100%> (ø) ⬆️
...re-database/src/repositories/utils/sort-entries.ts 100% <100%> (ø)
...ages/core-database/src/database-service-factory.ts 44.44% <25%> (-12.7%) ⬇️
...ckages/core-database/src/repositories/delegates.ts 67.44% <66.66%> (-0.86%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e02c2c8...f51534d. Read the comment docs.

@faustbrian faustbrian changed the title fix(core-database): properly sort BigNumber values [WIP] fix(core-database): properly sort BigNumber values Feb 23, 2019
@ghost
Copy link

ghost commented Feb 23, 2019

@faustbrian Your pull request doesn't have a test case, which is a requirement for it to be merged. Please provide it and one of the developers will review it before merging.

@faustbrian faustbrian changed the title [WIP] fix(core-database): properly sort BigNumber values fix(core-database): properly sort BigNumber values Feb 24, 2019
spkjp
spkjp previously requested changes Feb 25, 2019
if (["balance", "voteBalance"].includes(iteratee)) {
return Object.values(entries).sort((a: any, b: any) => {
return order === "asc"
? +a[iteratee].minus(b[iteratee]).toFixed()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use https://mikemcl.github.io/bignumber.js/#cmp for comparing BigNumbers.

@ghost
Copy link

ghost commented Feb 25, 2019

@faustbrian Your pull request needs some changes. Please wait for a comment from one of our developers for more information.

@faustbrian faustbrian merged commit b836819 into develop Feb 25, 2019
@ghost ghost deleted the sort branch February 25, 2019 04:59
@ghost ghost removed the Status: Needs Review label Feb 25, 2019
vasild added a commit that referenced this pull request Feb 27, 2019
* ArkEcosystem/core/2.3:
  chore: move core-graphql to the deprecated folder (#2169)
  refactor(crypto): benchmarks (#2167)
  refactor: replace micromatch with nanomatch and remove heavy deps (#2165)
  feat(crypto): increase vendor field length to 255 bytes (#2159)
  feat(core-api): search delegates by usernames (#2143)
  feat(core-logger-pino): initial implementation (#2134)
  perf(crypto): integrate bcrypto (#2158)
  feat(core): ask for process restarts after updating (#2155)
  refactor(core): replace pm2 with process manager (#2154)
  refactor(core): require the user to take action for updates (#2153)
  feat(core-p2p): Fetch list of peers from at least a few others (#2152)
  refactor(core): more robust check for ensureDefaults (#2151)
  fix(core): ensure file and defaults before reading
  fix(core): return correct suffix for core:restart command (#2150)
  fix(core-database): properly sort BigNumber values (#2144)
  feat(core): configuration and channel support for the CLI (#2145)
  feat(core): merge core-snapshot-cli commands into core (#2149)
  fix(core-api): pass query to findAllByVote method (#2142)
  feat(core-p2p): Validate GET replies from other peers (#2102)
  chore(release): 2.2.0-beta.7 (#2141)
  fix(core-blockchain): stuck at not ready to accept new block (#2139)
  refactor(core-p2p): Improve selection of peer for downloading blocks (#2137)
  fix(core): overwrite the config path if an env variable is provided (#2140)
  fix(core): do not ignore the network flag in parseWithNetwork (#2138)
  chore(release): 2.2.0-beta.6 (#2136)
  refactor(core-container): throw an error if the peers or plugins file are missing (#2135)
  chore(release): 2.2.0-beta.5 (#2132)
  refactor(core-p2p):  reduce logging noise (#2129)
  misc(core-p2p): remove superfluous log message (#2128)
  refactor(core-p2p): Improve fork handling in updatePeersOnMissingBlocks (#2125)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants