@@ -986,13 +986,21 @@ export class PomodoroTimer {
986986 // OVERTIME: If in overtime and continuous sessions, save session and skip double-counting
987987 if ( this . timeRemaining < 0 && this . allowContinuousSessions ) {
988988 shouldSaveSession = true ;
989- this . sessionCompletedButNotSaved = false ;
990-
991- // Save overtime focus session to SessionManager as individual session
992- // Only save if session lasted at least 1 minute
993- if ( this . currentMode === 'focus' && this . lastCompletedSessionTime > 3 ) {
994- await this . saveCompletedFocusSession ( ) ;
989+
990+ // During overtime, if session was completed but not saved, now save it with overtime included
991+ if ( this . sessionCompletedButNotSaved && this . currentMode === 'focus' ) {
992+ // Calculate total time including overtime
993+ const now = Date . now ( ) ;
994+ const totalElapsedTime = Math . floor ( ( now - this . sessionStartTime ) / 1000 ) ;
995+ this . lastCompletedSessionTime = totalElapsedTime ;
996+
997+ // Only save if session lasted at least 1 minute
998+ if ( this . lastCompletedSessionTime > 60 ) {
999+ await this . saveCompletedFocusSession ( ) ;
1000+ }
9951001 }
1002+
1003+ this . sessionCompletedButNotSaved = false ;
9961004
9971005 // Move to next mode as usual
9981006 if ( this . currentMode === 'focus' ) {
@@ -1338,8 +1346,7 @@ export class PomodoroTimer {
13381346 // Mark session as completed but not saved yet (will be saved when user skips)
13391347 this . sessionCompletedButNotSaved = true ;
13401348
1341- // Save completed focus session to SessionManager immediately
1342- await this . saveCompletedFocusSession ( ) ;
1349+ // Don't save session immediately during overtime - wait for skip to include full duration
13431350 }
13441351
13451352 // For continuous sessions, don't save the session data here
0 commit comments