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

Skip rendering badges that are complete #46

Merged
merged 3 commits into from
Jul 4, 2024

Conversation

aristath
Copy link
Member

@aristath aristath commented Jul 4, 2024

Context

If all badges are complete, we should not display the separate badge-progress widgets.

Relevant technical choices:

  • Added a should_render() method for widgets. If all badges are complete, then this method will return false.
  • Added caching in the get_badge_details() methods using a static var to avoid re-calculating things.

Quality assurance

  • I have tested this code to the best of my abilities.
  • I have added unit tests to verify the code works as intended.
  • I have checked that the base branch is correctly set.

Fixes #

Copy link
Contributor

github-actions bot commented Jul 4, 2024

Test on Playground
Test this pull request on the Playground or download the zip

Copy link
Member

@jdevalk jdevalk left a comment

Choose a reason for hiding this comment

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

One question :)

classes/widgets/class-badge-content.php Outdated Show resolved Hide resolved
classes/widgets/class-badge-streak.php Outdated Show resolved Hide resolved
@aristath aristath requested a review from jdevalk July 4, 2024 08:07
@jdevalk jdevalk merged commit 7f28267 into develop Jul 4, 2024
18 checks passed
@jdevalk jdevalk deleted the skip-completed-badge-widgets branch July 4, 2024 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants