Repository navigation
refactor: adjust UpdateCardProgress to handle bulk update - #41
Merged
Dejmenek merged 5 commits intoSep 4, 2025
Merged
Conversation
Updated the ICardsRepository interface to remove the UpdateCardProgress method and introduce UpdateCardsProgressBulkAsync, which accepts an IEnumerable<CardProgressUpdateDto> for bulk updates. The CardsRepository implementation has been modified to use a SQL stored procedure for efficient bulk updates via a DataTable, enhancing performance by reducing the number of database calls. Logging and error handling have also been updated to reflect these changes.
Updated `DataContext.cs` to include new methods for creating database types and stored procedures. The `Init` method now calls `CreateTypes` and `CreateProcedures`, enhancing the database setup process. Introduced a new stored procedure `UpdateCardProgressBulk` in `CreateStoredProcedures.sql` for bulk updating card progress using a table-valued parameter. Modified `CreateTables.sql` to drop the `UpdateCardProgressBulk` procedure and several tables, ensuring a clean setup. Updated `CreateTypes.sql` to drop and recreate the `CardProgressTVP` type with the necessary fields for card progress tracking.
A new class named `CardProgressUpdateDto` has been added to the `Flashcards.Models` namespace. This class includes three properties: `CardId`, `Box`, and `NextReviewDate`, which are essential for tracking the progress of flashcards in the application.
The SQL update statement that modified the `Box` and `NextReviewDate` fields in the `Cards` table has been removed. This change eliminates unnecessary code that was intended to update card details based on the card's `Id`.
Added new stored procedures and types in `SqlScripts.Designer.cs` to manage card progress in the flashcard application. Introduced `CreateStoredProcedures` and `CreateTypes` for bulk updates and new table types. Removed the `UpdateCardProgress` string and its corresponding SQL script, reflecting the updated functionality. Updated `SqlScripts.resx` to include new entries for the added procedures and types while removing the obsolete `UpdateCardProgress` entry.
Dejmenek
deleted the
40-refactor-updatecardprogress-to-handle-bulk-update
branch
September 4, 2025 09:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request refactors
UpdateCardProgressfor bulk updating card progress and enhances the database initialization process.Changes
DataContext.cs: Added methodsCreateTypesandCreateProceduresfor database setup.ICardsRepository.cs: ReplacedUpdateCardProgresswithUpdateCardsProgressBulkAsyncfor bulk updates.CardsRepository.cs: Implemented the new bulk update logic using a stored procedure with a table-valued parameter.CardProgressUpdateDto.cs: Introduced a new DTO class for encapsulating card progress update data.UpdateCardProgressand addedUpdateCardProgressBulkstored procedure along with new scripts for types and procedures.