Conversation
Co-authored-by: maorun <2291503+maorun@users.noreply.github.com>
Co-authored-by: maorun <2291503+maorun@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] mit letzten commit ein bug
Fix notification spam bug by persisting notification state across module reloads
Oct 1, 2025
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.
Problem
Users were experiencing constant "Daily goal exceeded!" notifications since the last feature commit. The notifications would appear repeatedly whenever performing common operations like viewing the weekly overview or adding time entries, even when the daily goal notification was configured for
oncePerDay = true.Root Cause
The notification state tracking was stored in a module-local variable that gets reset every time the Lua module is reloaded:
Since
checkDailyGoalNotification()is called from within thecalculate()function, andcalculate()is invoked frequently (weekly overview, adding time, etc.), users would see repeated notifications whenever these operations reset the notification tracking state.Solution
This PR implements persistent notification state by:
Adding state persistence functions:
loadNotificationState()- Loads notification state from the JSON data filesaveNotificationState()- Saves notification state to the JSON data fileIntegrating with existing data storage:
config_module.obj.content.notificationStateMaintaining all existing functionality:
Changes Made
M.init()to load notification state after JSON data is loadedcheckDailyGoalNotification()checkCoreHoursCompliance()_handleModeSwitch()Testing
All existing tests continue to pass (169/169), ensuring no regressions were introduced. The fix specifically addresses the notification spam issue while preserving all existing notification functionality.
Fixes #[issue_number]
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.