-
Notifications
You must be signed in to change notification settings - Fork 6
fix: active contest vote tallies were not being updated with refresh button #6
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
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThe pull request introduces modifications to the Changes
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
src/ui/identities/register_dpns_name_screen.rs (1)
70-72: LGTM! Consider a minor readability improvement.The changes simplify the display logic for identity selection, which aligns with the AI summary's description of streamlining the process. The code now correctly uses the alias if available, falling back to the identity ID if not.
For improved readability, consider extracting the display text logic into a separate method:
ui.selectable_value( &mut self.selected_qualified_identity, Some(qualified_identity.clone()), - qualified_identity.alias.as_ref().unwrap_or( - &qualified_identity.identity.id().to_string(Encoding::Base58), - ), + self.get_identity_display_text(qualified_identity), ) + // Add this method to the impl block + fn get_identity_display_text(&self, qualified_identity: &QualifiedIdentity) -> String { + qualified_identity.alias.clone().unwrap_or_else(|| + qualified_identity.identity.id().to_string(Encoding::Base58) + ) + }This change would make the main logic more concise and easier to understand at a glance.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- src/database/contested_names.rs (4 hunks)
- src/ui/identities/register_dpns_name_screen.rs (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
src/ui/identities/register_dpns_name_screen.rs (1)
Line range hint
1-190: Verify alignment with PR objectivesThe changes in this file focus on improving the identity selection display logic, which is a positive enhancement. However, these modifications don't appear to address the stated PR objectives of fixing "active contest vote tallies not being updated with refresh button".
To ensure we're not missing any relevant changes, please run the following script:
This script will help us verify if there are any other files in the codebase that might contain the changes related to the PR objectives. If no results are found, we may need to clarify the scope of the PR with the author.
src/database/contested_names.rs (1)
464-464: Verify handling ofNonetimestamps when sortingWhen sorting
names_to_be_updated, the code usesa.1.unwrap_or(0), assigning a timestamp of0to entries wherelast_updatedisNone. This causes these entries to be considered the oldest. If this is intentional and you want entries with nolast_updatedto appear first, please confirm. Otherwise, consider using a more appropriate default value or adjusting the sorting logic to ensure correct ordering.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
The function
insert_name_contests_as_normalized_nameswas returning only names that have not been updated for over an hour, and these names were being used to update the UI showing the contest states. But on testnet, contests only last one hour. So the votes for those names were not being displayed. So instead, we check the network and if it's testnet, we only update the contests created in the past hour, and on mainnet, created in the past two weeks.Also, in registering dpns names, display aliases instead of identifiers.
Summary by CodeRabbit
New Features
Bug Fixes