Skip to content

feat: add Leitner system handling in StudySessionsService - #45

Merged
Dejmenek merged 4 commits into
mainfrom
34-update-studysessionsservice
Sep 5, 2025
Merged

Dejmenek merged 4 commits into
mainfrom
34-update-studysessionsservice

Conversation

@Dejmenek

@Dejmenek Dejmenek commented Sep 4, 2025

Copy link
Copy Markdown
Owner

Summary

This pull request implements Leitner system handling in StudySessionsService.

Changes

  • CardsRepository.cs: Added asynchronous connection opening for bulk updates.
  • IStudySessionsService.cs: Changed StartStudySessionAsync to return Task<Result>.
  • StudySessionsService.cs: Introduced dependency on ICardsRepository and modified StartStudySessionAsync to be asynchronous.
  • StudySessionsService.cs: Added private methods GetNextBox and GetNextReviewDate for determining card progress.
  • StudySessionsService.cs: Updated RunStudySessionAsync to await StartStudySessionAsync for improved error handling.
  • StudySessionsService.cs: Added Leitner system handling.

This change introduces an asynchronous operation to open a SQL connection in the `CardsRepository` class. By using `await connection.OpenAsync();`, the connection to the database is established without blocking the calling thread, enhancing the efficiency of the operation.
@Dejmenek Dejmenek linked an issue Sep 4, 2025 that may be closed by this pull request
Added a new dependency on `ICardsRepository` in the `StudySessionsServiceTests` class, updating the constructor and service instantiation. Mocked `_cardsRepository.UpdateCardsProgressBulkAsync` to simulate card progress updates. Updated the `StartStudySessionAsync_ShouldResetScore_WhenCalledMultipleTimes` test to await asynchronous calls, improving test coverage and ensuring proper handling of async operations.
@Dejmenek
Dejmenek merged commit d7d6fdd into main Sep 5, 2025
2 checks passed
@Dejmenek
Dejmenek deleted the 34-update-studysessionsservice branch September 5, 2025 11:56
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.

Update StudySessionsService

1 participant