Skip to content

Conversation

@BAW2501
Copy link
Contributor

@BAW2501 BAW2501 commented Jul 5, 2024

Description:

closes #823
This pull request refactors the TimeIncrement.display method to utilize the clockLabelInMinutes function for better readability and maintainability. Additionally, it addresses an edge case noted in issue #823, where non-integer minute values were not displayed correctly. This ensures the correct display of time increments such as 1.5+5.

Changes Made:

  1. Refactored TimeIncrement.display Method:

    • The display method now leverages the clockLabelInMinutes function to convert time in seconds to a more readable minute format.
    • This change simplifies the logic and ensures consistent formatting for various time values.
  2. Fixed Edge Case:

    • The issue where a time of 90+5 seconds was incorrectly displayed as 1+5 instead of 1.5+5 has been resolved.
  3. Added Unit Tests:

    • Created a new test file time_increment_test.dart to cover the functionality of the TimeIncrement class.
    • Tests include initialization, JSON serialization, display string formatting, estimated duration calculation, equality checks, and the clockLabelInMinutes function.

Files Modified:

  • lib/src/model/common/time_increment.dart:
  • test/model/common/time_increment_test.dart:

Testing:

  • Verified that all unit tests pass successfully, confirming the correctness of the display method and the clockLabelInMinutes function.

Copy link
Contributor

@veloce veloce left a comment

Choose a reason for hiding this comment

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

Thanks!

@veloce veloce merged commit c4b3855 into lichess-org:main Jul 8, 2024
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.

Creating a 1.5 minute game displays as 1 minute in queue screen

2 participants