feat: tmpo undo to revert a previous action#119
Merged
Conversation
Save undo actions only after the associated DB operation succeeds by moving db.SaveLastAction calls to after DeleteTimeEntry/StopEntry in delete, tracking pause and stop commands. This prevents stale/incorrect undo state when the DB operation fails. Additionally, UncompleteEntry now checks RowsAffected and returns an explicit error if no rows were updated (entry not found), improving error handling.
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.
Pull Request Checklist
mainbranch of tmpo.Closes #116
Description
This pull request introduces an "undo" feature to the application, allowing users to revert their most recent time-tracking action. The implementation tracks user actions (such as start, stop, pause, resume, manual entry creation, and deletion) and provides a new
undocommand to roll back the last action. The change also includes comprehensive tests for the new undo functionality and its integration with the storage layer.Undo Feature Implementation
undocommand (UndoCmd) that allows users to undo their most recent time-tracking action. The command provides user feedback, confirmation prompts, and handles various action types appropriately.start,stop,pause,resume,manual,delete) by saving anUndoActionto the database after each action. [1] [2] [3] [4] [5] [6]undocommand in the application's root command.Storage Layer Enhancements
UndoActiontype and related methods to the storage layer for saving, retrieving, and clearing the last action. Also added methods to "uncomplete" (re-open) an entry and restore deleted entries, supporting the undo logic.Testing
User Interface
EmojiUndo) to visually indicate undo actions in the UI.