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

feat: Add option to use short number format #745

Merged
merged 4 commits into from
Dec 10, 2024

Conversation

DenverCoder1
Copy link
Owner

@DenverCoder1 DenverCoder1 commented Dec 10, 2024

Resolves #729

This pull request introduces a new feature to format numbers using locale and short number notation. The changes include adding a new function for number formatting, integrating this function into the card generation process, and updating the demo and tests to support the new feature.

New Feature: Short Number Formatting

  • src/card.php: Added formatNumber function to format numbers using locale and short number notation. Integrated this function into the generateCard method to replace the existing number formatting logic. [1] [2] [3] [4]
  • src/demo/index.php: Added a new dropdown in the demo interface to enable or disable short number formatting.
  • src/demo/js/script.js: Updated the preview object to include the short_numbers parameter.
  • tests/RenderTest.php: Added a test case to verify the short number formatting feature.

Add the option to display the Total Contributions count in short form.

* Add a new parameter `short_total_contributions` to the `generateCard` function in `src/card.php` with a default value of `false`.
* Implement a `shortNumber` function in `src/card.php` to convert large numbers into short form.
* Update the `generateCard` function in `src/card.php` to use the `shortNumber` function if `short_total_contributions` is `true`.
* Use the `shortNumber` function for current streak and longest streak if `short_total_contributions` is `true`.
* Add a new input field for `short_total_contributions` in the form in `src/demo/index.php`.
* Add a test case for the new `short_total_contributions` parameter in `tests/RenderTest.php`.
@DenverCoder1 DenverCoder1 temporarily deployed to streak-stats-add-short--vneqo1 December 10, 2024 09:41 Inactive
@DenverCoder1 DenverCoder1 marked this pull request as draft December 10, 2024 09:42
@DenverCoder1 DenverCoder1 temporarily deployed to streak-stats-add-short--vneqo1 December 10, 2024 09:42 Inactive
@DenverCoder1 DenverCoder1 temporarily deployed to streak-stats-add-short--vneqo1 December 10, 2024 10:04 Inactive
@DenverCoder1 DenverCoder1 marked this pull request as ready for review December 10, 2024 10:10
@DenverCoder1 DenverCoder1 temporarily deployed to streak-stats-add-short--vneqo1 December 10, 2024 10:17 Inactive
@DenverCoder1 DenverCoder1 changed the title Add the option to use short form for the Total Contributions count feat: Add option to use short number format Dec 10, 2024
@DenverCoder1 DenverCoder1 merged commit 054044c into main Dec 10, 2024
4 checks passed
@DenverCoder1 DenverCoder1 deleted the add-short-total-contributions branch December 10, 2024 10:19
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.

Add the option to use short form for the Total Contributions count
1 participant