Prevent negative values of progressPerHour #508

pull HiLivin wants to merge 1 commits into bitcoin-core:master from HiLivin:master changing 1 files +1 −1
  1. HiLivin commented at 11:40 pm on December 13, 2021: contributor
    Added a similar guard to progressPerHour as is placed at remainingMSecs. It prevents the display of negative values like “-0.00%” in some cases.
  2. shaavan approved
  3. shaavan commented at 9:25 am on December 14, 2021: contributor

    ACK ef1754336dfd5340a41df5cc6a0abb2d3bc60fec

    It makes logical sense that progress shall always be a non-negative number. Hence, I agree with the change.

  4. hebasto renamed this:
    qt: prevent negative values of progressPerHour
    Prevent negative values of progressPerHour
    on Dec 14, 2021
  5. hebasto added the label UX on Dec 14, 2021
  6. hebasto commented at 11:42 am on December 14, 2021: member

    ACK ef1754336dfd5340a41df5cc6a0abb2d3bc60fec

    Negative progress is meaningless. Tested with a custom patch.

    Related to https://github.com/bitcoin/bitcoin/issues/11265.

  7. in src/qt/modaloverlay.cpp:111 in ef1754336d outdated
    107@@ -108,7 +108,7 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri
    108             if (sample.first < (currentDate.toMSecsSinceEpoch() - 500 * 1000) || i == blockProcessTime.size() - 1) {
    109                 progressDelta = blockProcessTime[0].second - sample.second;
    110                 timeDelta = blockProcessTime[0].first - sample.first;
    111-                progressPerHour = progressDelta / (double) timeDelta * 1000 * 3600;
    112+                progressPerHour = (progressDelta > 0) ? progressDelta / (double) timeDelta * 1000 * 3600 : 0;
    


    hebasto commented at 11:44 am on December 14, 2021:

    nit: clang-format-diff.py insist on

    0                progressPerHour = (progressDelta > 0) ? progressDelta / (double)timeDelta * 1000 * 3600 : 0;
    
  8. hebasto commented at 2:14 pm on December 14, 2021: member

    @HiLivin

    Thanks. To make this PR ready to get merged, please squash your two commits into one. See https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commits

  9. HiLivin force-pushed on Dec 14, 2021
  10. HiLivin commented at 5:56 pm on December 14, 2021: contributor
    @hebasto Thank you. I had some issues (pulled other commits by mistake), but it should be OK now.
  11. hebasto commented at 6:03 pm on December 14, 2021: member

    @HiLivin

    Thank you! It looks pretty good now.

    When you squashed you commits the previous second commit message goes into the current commit message. It will look irrelevant in the commit history after merging. So please leave only the original commit message.

    And no need to tag me as a co-author :)

  12. qt: prevent negative values of progressPerHour
    Added a similar guard to progressPerHour as is placed at remainingMSecs.
    It prevents the display of negative values like "-0.00%" in some cases.
    71d33380ed
  13. HiLivin force-pushed on Dec 14, 2021
  14. HiLivin commented at 6:51 pm on December 14, 2021: contributor
    @hebasto Done. Thanks for advice.
  15. hebasto approved
  16. hebasto commented at 7:17 pm on December 14, 2021: member
    ACK 71d33380ed6858b4a65b396332bfb22d984642a6
  17. jarolrod commented at 8:16 am on December 15, 2021: member
    ACK 71d3338
  18. shaavan approved
  19. shaavan commented at 11:27 am on December 15, 2021: contributor

    reACK 71d33380ed6858b4a65b396332bfb22d984642a6

    Changes since my last review:

    • Formatting of the added patch has been fixed.

    I have checked that the formatting of this PR is now correct.

    p.s.: It looks this is your first PR. A warm welcome, @HiLivin!!

  20. hebasto merged this on Dec 15, 2021
  21. hebasto closed this on Dec 15, 2021

  22. sidhujag referenced this in commit 5ef7401554 on Dec 15, 2021
  23. bitcoin-core locked this on Dec 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-22 02:20 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me