Refactor open date range to use std::optional #354

pull promag wants to merge 1 commits into bitcoin-core:master from promag:2021-06-date-range changing 3 files +19 −25
  1. promag commented at 8:59 am on June 3, 2021: contributor
    Use std::nullopt for open date range instead of TransactionFilterProxy::MIN_DATE and TransactionFilterProxy::MAX_DATE.
  2. hebasto added the label Refactoring on Jun 3, 2021
  3. promag force-pushed on Jun 3, 2021
  4. hebasto commented at 12:55 pm on June 9, 2021: member
    Concept ACK
  5. hebasto approved
  6. hebasto commented at 6:17 pm on June 11, 2021: member
    ACK a7837ba08bc10c9aaca6f28d9c2be9b8430323f5, I have reviewed the code and it looks OK, I agree it can be merged.
  7. hebasto commented at 6:20 pm on June 11, 2021: member
    nit: include <optional> to the src/qt/transactionview.cpp as std::nullopt are used there.
  8. qt: Refactor open date range to use std::optional 4830f4912a
  9. promag force-pushed on Jun 11, 2021
  10. hebasto approved
  11. hebasto commented at 10:52 am on June 12, 2021: member
    re-ACK 4830f4912a538600e9e9133442e9f8d929006630, only missed header included since my previous review.
  12. in src/qt/transactionfilterproxy.cpp:42 in 4830f4912a
    38@@ -46,8 +39,8 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &
    39         return false;
    40 
    41     QDateTime datetime = index.data(TransactionTableModel::DateRole).toDateTime();
    42-    if (datetime < dateFrom || datetime > dateTo)
    43-        return false;
    44+    if (dateFrom && datetime < *dateFrom) return false;
    


    Talkless commented at 1:04 pm on August 11, 2021:
    std::optional does support comparison without dereferencing (see (26) in https://en.cppreference.com/w/cpp/utility/optional/operator_cmp) but your variant is better as operator< would repeat if (opt) check you already (rightly) did.
  13. Talkless approved
  14. Talkless commented at 1:05 pm on August 11, 2021: none
    tACK 4830f4912a538600e9e9133442e9f8d929006630, tested on Debian Sid, filtering seems to work as expected.
  15. hebasto merged this on Aug 11, 2021
  16. hebasto closed this on Aug 11, 2021

  17. sidhujag referenced this in commit 0428adb84e on Aug 15, 2021
  18. bitcoin-core locked this on Aug 16, 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