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

Format donation count output in progress bar component #7209

Merged
merged 5 commits into from
Dec 10, 2024

Conversation

DevinWalker
Copy link
Member

@DevinWalker DevinWalker commented Jan 29, 2024

Resolves #7208 GIVE-2050

Description

This resolves the issue with the "Donation" count total not being formatted properly.

I'm using give_format_amount() for this, even though it's a total, not an amount because I didn't see any other generic non-currency-based way to do it. This seems to work fine, though.

Affects

Progress bar component with donation counts.

Visuals

Before

2024-01-29_10-54-15

After
2024-01-29_11-43-53

Pre-review Checklist

  • Acceptance criteria satisfied and marked in related issue
  • Relevant @unreleased tags included in DocBlocks
  • Includes unit tests
  • Reviewed by the designer (if follows a design)
  • Self Review of code and UX completed

This commit changes the return type of the getDonationCount function from int to string. It also introduces formatting, specifically disabling sanitization, decimal, and currency formatting options for the returned count, using the give_format_amount function.
The getDonationCount method now returns a formatted donation count string, instead of an int. A new method, getFormattedDonationCount, has been introduced to apply the give_format_amount function, turning off sanitization, decimal, and currency formatting. This results in a cleaner display of donation counts in the progress bar.
@DevinWalker DevinWalker changed the title Update getDonationCount return type and formatting Format donation count output in progress bar component Jan 29, 2024
Copy link

This PR is stale because it has been open 45 days with no activity. Stale PRs will NOT be automatically closed.

@github-actions github-actions bot added the Stale label Mar 18, 2024
@github-actions github-actions bot removed the Stale label Oct 22, 2024
Copy link

github-actions bot commented Dec 6, 2024

This PR is stale because it has been open 45 days with no activity. Stale PRs will NOT be automatically closed.

@github-actions github-actions bot added the Stale label Dec 6, 2024
Copy link
Member

@kjohnson kjohnson left a comment

Choose a reason for hiding this comment

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

Ideally, we would format these numbers using the browser's locale (as opposed to the currency of the site), but given that this is legacy functionality (and is updated to match the rest of the page) this is good enough to re-use the currency formatting functions for this component.

@github-actions github-actions bot removed the Stale label Dec 7, 2024
Copy link
Member

@rickalday rickalday left a comment

Choose a reason for hiding this comment

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

Passed QA tests

@jonwaldstein jonwaldstein merged commit 5d7d4b6 into develop Dec 10, 2024
20 checks passed
@jonwaldstein jonwaldstein deleted the fix/donation-count-formatting-7208 branch December 10, 2024 16:48
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.

Multi-form goal block should have formatted donation number total
4 participants