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

gui, poll: Implement poll expiration reminders #2716

Conversation

jamescowens
Copy link
Member

@jamescowens jamescowens commented Nov 20, 2023

This PR implements automatic notification of poll expiration in the wallet GUI using the standard notification class.

It builds on #2709 which reduce the amount of processing required for new polls and votes to a low enough level to enable trigger based refresh of polls/votes.

The options model (options tabbed dialog) has been extended to add an "Hours before poll expiry reminder" field, which accepts a floating point number specifying the amount of time before when a poll expires to issue a reminder notification to the user if the user has not yet voted on a poll. This uses a validated line edit class, which validates that the value of this field is between 0.25 and 24.0 hours, inclusive.

The poll reminder pattern implemented here is a single shot notification. Each poll entry carries a flag that indicates whether a pending expiration notification has occurred. These are grouped together to form a poll list, because there could be more than one. When the list of polls expiring within the "hours before poll expiry reminder" is formed and presented in the GUI as a notification, the flag m_expire_notified for each poll in the list is set to true to prevent further notification while the wallet is resident. (A wallet restart will clear this.)

The manual refresh of the voting tab, current poll list has been changed from manual to automatic, based on the following triggers:

  1. Receipt of new poll
  2. Receipt of new vote
  3. One minute timer that also controls the poll expiration handler. This handles both the existing poll expiration case and the case of a wallet restart with an existing poll. (In the wallet restart case, the one minute timer will cause the poll table refresh to be approximately one minute after the wallet is synced.

This automatic refresh now causes the current poll tab to be kept up to date, and also supports the logic to determine whether the current wallet holder has already voted, in which case the poll reminder is suppressed for that poll.

Closes #2648.

@jamescowens jamescowens force-pushed the implement_poll_expiration_reminders branch 3 times, most recently from c5d1d58 to cd9306f Compare November 25, 2023 06:16
Also address wallet restart with existing current polls.
The handling for last vote did not really work correctly in the case
where the walletholder votes multiple times. Because of the way the voting
system handles duplicate outputs in the vote tallying, using the last vote
only does not necessarily contain the entire weight or all the choices for
the walletholder.

This commit implements showing each choice that has weight  and the weight
on each one.
@jamescowens jamescowens force-pushed the implement_poll_expiration_reminders branch from cd9306f to 44e832c Compare November 25, 2023 07:08
@jamescowens jamescowens force-pushed the implement_poll_expiration_reminders branch from fd33338 to 3e58720 Compare December 5, 2023 00:06
@jamescowens jamescowens marked this pull request as ready for review December 5, 2023 00:15
Copy link
Member

@div72 div72 left a comment

Choose a reason for hiding this comment

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

ACK 3e58720.

src/qt/optionsmodel.cpp Outdated Show resolved Hide resolved
@jamescowens jamescowens force-pushed the implement_poll_expiration_reminders branch from 3e58720 to 4946c54 Compare December 10, 2023 16:43
@jamescowens jamescowens merged commit 82ee638 into gridcoin-community:development Dec 10, 2023
17 checks passed
jamescowens added a commit to jamescowens/Gridcoin-Research that referenced this pull request Mar 2, 2024
Added
 - contrib: add nix file for compilation environment gridcoin-community#2660 (@div72)
 - gui: Make main Gridcoin window geometry save unique to datadir location gridcoin-community#2661 (@jamescowens)
 - build: Initial CMake support gridcoin-community#2676 (@CyberTailor)
 - util: Add `-shutdownnotify` and `startupnotify` options from upstream gridcoin-community#2688 (@barton2526)
 - gui, staking: Implement facilities for mandatory sidestakes and sidestake GUI gridcoin-community#2704 (@jamescowens)
 - gui, voting: Implement poll result caching and poll stale indicator gridcoin-community#2709 (@jamescowens)
 - gui, projects: Implement greylist state for projects in GUI projects table gridcoin-community#2715 (@jamescowens)
 - gui, poll: Implement poll expiration reminders gridcoin-community#2716 (@jamescowens)
 - serialize: allow variants to be serialized gridcoin-community#2729 (@div72)
 - gui: Implement poll field length limiters in GUI forms gridcoin-community#2742 (@jamescowens)

Changed
 - consensus, contract, scraper, protocol, project, beacon, rpc: Replace remaining appcache sections with native structures gridcoin-community#2639 (@jamescowens)
 - build: update libsecp256k1 to v0.3.0 gridcoin-community#2655 (@div72)
 - build: Replace $(AT) with .SILENT gridcoin-community#2674 (@barton2526)
 - build: allow system bdb gridcoin-community#2675 (@div72)
 - Resize Header Column with Additional Text gridcoin-community#2683 (@PrestackI)
 - rpc: use RPCErrorCode everywhere gridcoin-community#2687 (@Pythonix)
 - wallet: SecureString to allow null characters gridcoin-community#2690 (@barton2526)
 - random: port some upstream changes gridcoin-community#2696 (@div72)
 - depends: Bump dependencies gridcoin-community#2692 (@barton2526)
 - doc: Update link to Discord server gridcoin-community#2693 (@adriaanjoubert)
 - rpc: Change capitalization, remove whitespace of rpc keys gridcoin-community#2711 (@Pythonix)
 - ci: bump MacOS version to 12 gridcoin-community#2713 (@div72)
 - depends: no-longer nuke libc++abi.so* in native_clang package gridcoin-community#2719 (@div72)
 - doc: update windows `-fstack-clash-protection` doc gridcoin-community#2720 (@div72)
 - Silence `-Wcast-function-type` warning gridcoin-community#2721 (@div72)
 - build: Use newest `config.{guess,sub}` available gridcoin-community#2722 (@div72)
 - refactor: use the try_lock result in TryEnter gridcoin-community#2723 (@div72)
 - Updates for file src/qt/locale/bitcoin_en.ts in pt_PT gridcoin-community#2726 (@gridcoin-community)
 - ci: do not silently fail gridcoin-community#2727 (@div72)
 - Properly include Boost Array header gridcoin-community#2730 (@theMarix)
 - build: Update depends zlib to 1.3.1 gridcoin-community#2734 (@jamescowens)
 - util: Enhance Fraction class overflow resistance gridcoin-community#2735 (@jamescowens)
 - refactor: Fix compilation warnings gridcoin-community#2737 (@jamescowens)
 - gui, util: Improve upgrade dialog gridcoin-community#2738 (@jamescowens)
 - util: Improve allocation class gridcoin-community#2740 (@jamescowens)
 - translations: translation updates for Miss Piggy release gridcoin-community#2745 (@jamescowens)

Removed
 - gui: Disable snapshot GUI action gridcoin-community#2700 (@jamescowens)
 - build, crypto, script: remove most of OpenSSL usage gridcoin-community#2705 (@div72)
 - util: remove WSL 1 workaround in fs gridcoin-community#2717 (@div72)

Fixed
 - diagnostics: fix missing arg in ETTS warning gridcoin-community#2684 (@div72)
 - misc: fix include guard in netaddress.h gridcoin-community#2695 (@div72)
 - gui: Fix expired pending beacon display gridcoin-community#2698 (@jamescowens)
 - consensus: Fix 20230904 testnet forking issue gridcoin-community#2703 (@jamescowens)
 - gui: Fix filter by type in Transaction View gridcoin-community#2708 (@jamescowens)
 - depends: make fontconfig build under clang-16 gridcoin-community#2718 (@div72)
 - diag: fix researcher mode check gridcoin-community#2725 (@div72)
 - gui: Add missing switch cases for ALREADY_IN_MEMPOOL gridcoin-community#2728 (@jamescowens)
 - beacon, registry: Fix beacon history stall gridcoin-community#2731 (@jamescowens)
 - build: Implement comp_double comparison function in certain tests gridcoin-community#2741 (@jamescowens)
 - ci: change Qt path in CMake CI gridcoin-community#2743 (@div72)
 - net: Correct -tor argument handling gridcoin-community#2744 (@jamescowens)
@jamescowens jamescowens deleted the implement_poll_expiration_reminders branch July 21, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Idea: Reminder for polls
2 participants