Add has_contributed_current_round view function#102
Open
WuXieSec wants to merge 1 commit intosorosave-protocol:mainfrom
Open
Add has_contributed_current_round view function#102WuXieSec wants to merge 1 commit intosorosave-protocol:mainfrom
WuXieSec wants to merge 1 commit intosorosave-protocol:mainfrom
Conversation
Changes: - Add has_contributed_current_round(member, group_id) function - Returns boolean indicating if member contributed to current round - Handles non-active groups (returns false) - Handles non-members (returns false) - Add comprehensive test coverage This provides a simpler API for checking current round contributions without requiring the caller to know the current round number. Closes sorosave-protocol#58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a simplified view function to check if a member has contributed to the current round, as requested in #58.
Changes:
has_contributed_current_round(member, group_id)functionfalseif group is not activefalseif member is not in the groupfalseif round is not activeWhy this is useful:
The existing
has_contributed(member, group_id, round)requires the caller to know the current round number. This new function simplifies the common case where you just want to check the current round.Example use case:
Frontend can easily show "You have contributed this round" status without first querying the group to get the current round number.
Closes #58