Skip to content

refactor: move logic from StudySessionsService to StudySessionsHelper - #55

Merged
Dejmenek merged 3 commits into
mainfrom
53-move-getnextbox-and-getnextreviewdate-to-a-helper-class
Oct 27, 2025
Merged

Dejmenek merged 3 commits into
mainfrom
53-move-getnextbox-and-getnextreviewdate-to-a-helper-class

Conversation

@Dejmenek

Copy link
Copy Markdown
Owner

Summary

This pull request introduces a new helper class for managing study session logic and refactors existing service methods to utilize this helper. It also moves test methods from study sessions service to the helper class tests.

Changes

  • StudySessionsHelperTests.cs: Moved unit tests for GetNextBox and GetNextReviewDate methods from StudySessionsServiceTests.cs.
  • StudySessionsHelper.cs: Introduced a new class with static methods for calculating the next box and review date from StudySessionsService.cs.
  • StudySessionsService.cs: Refactored to use StudySessionsHelper methods instead of private methods for box and review date calculations.

Introduced a new static class `StudySessionsHelper` in the `Flashcards.Helpers` namespace. This class includes two static methods: `GetNextBox` and `GetNextReviewDate`, which determine the next box number and review date based on the correctness of the answer and the current box number. The logic for these methods was previously implemented as private methods in the `StudySessionsService` class, which have now been removed. The `StudySessionsService` class has been updated to utilize the new helper methods, enhancing code organization and reusability.
Created a new `StudySessionsHelperTests.cs` file with unit tests for the `StudySessionsHelper` class, including methods to validate the next box and review date functionality. Removed outdated tests and helper methods from `StudySessionsServiceTests.cs`, indicating a refactor and a shift in focus for testing the service layer.
@Dejmenek Dejmenek linked an issue Oct 27, 2025 that may be closed by this pull request
@Dejmenek
Dejmenek merged commit 482d7c8 into main Oct 27, 2025
2 checks passed
@Dejmenek
Dejmenek deleted the 53-move-getnextbox-and-getnextreviewdate-to-a-helper-class branch October 27, 2025 14:10
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.

Move GetNextBox and GetNextReviewDate to a Helper Class

1 participant