mirror of
https://github.com/tiennm99/ccstatusline.git
synced 2026-10-13 08:15:18 +00:00
Fix for block timer calculation when last activity was in a previous block. Was incorrectly displaying an active block due to the diff of last activity and current block start
This commit is contained in:
1 parent
539be98470
commit
f9a113a9d2
3 files changed
+9
-8
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ccstatusline",
|
||||
"version": "2.0.5",
|
||||
"version": "2.0.6",
|
||||
"description": "A customizable status line formatter for Claude Code CLI",
|
||||
"module": "src/ccstatusline.ts",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export interface BlockMetrics {
|
||||
startTime: Date;
|
||||
lastActivity: Date;
|
||||
isActive: boolean;
|
||||
}
|
||||
+8
-6
@@ -294,16 +294,18 @@ function findMostRecentBlockStartTime(
|
||||
// The current block started after the completed blocks
|
||||
blockStart = new Date(flooredWorkStart.getTime() + (completedBlocks * sessionDurationMs));
|
||||
}
|
||||
const timeSinceActivity = now.getTime() - mostRecentTimestamp.getTime();
|
||||
const blockEnd = new Date(blockStart.getTime() + sessionDurationMs);
|
||||
|
||||
// Check if block is still active
|
||||
const isActive = timeSinceActivity < sessionDurationMs && now < blockEnd;
|
||||
const blockEnd = new Date(blockStart.getTime() + sessionDurationMs);
|
||||
const inBlockWindow = now.getTime() >= blockStart.getTime() && now.getTime() <= blockEnd.getTime();
|
||||
const activityInThisBlock = mostRecentTimestamp.getTime() >= blockStart.getTime() && mostRecentTimestamp.getTime() <= now.getTime();
|
||||
|
||||
const isActive = inBlockWindow && activityInThisBlock;
|
||||
if (!isActive)
|
||||
return null;
|
||||
|
||||
return {
|
||||
startTime: blockStart,
|
||||
lastActivity: mostRecentTimestamp,
|
||||
isActive
|
||||
lastActivity: mostRecentTimestamp
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user