fix(opencode): update stats command to filter messages by creation time#21934
Open
kmampent wants to merge 3 commits intoanomalyco:devfrom
Open
fix(opencode): update stats command to filter messages by creation time#21934kmampent wants to merge 3 commits intoanomalyco:devfrom
kmampent wants to merge 3 commits intoanomalyco:devfrom
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate Found:
Both PRs are targeting the same issue and implementing the same fix. You should verify which one should be used or if they need to be consolidated. |
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.
Issue for this PR
Closes #21920
Type of change
What does this PR do?
This PR updates the stats.ts file so that messages outside the time window defined by the value passed for the
--daysparameter are not considered when reporting usage statistics.We also add a unit test file for stats.ts with basic unit tests covering the logic addressed in this PR.
How did you verify your code works?
bun run test test/cli/cmd/stats.test.tssucceedsbun run testa the top most folder succeeds as well with the following outcome:OPENCODE_DB=/.../opencode.db bun dev stats --days=0that the output looks as expected. I compared the output reported with the output reported when directly examining the data stored in opencode's database viaopencode db.Screenshots / recordings
I have verified that other than the numbers reported, the graphical output of
OPENCODE_DB=/.../opencode.db bun dev stats --days=0matches that ofopencode stats --days=0.Checklist