playnite-gameactivity-plugin
playnite-gameactivity-plugin copied to clipboard
"View game activity" graph dates shifted
For every game's "View game activity", the dates when hovering over a graph bar are shifted back by a day. For example, when a session was recorded on December 17th, the mouseover text would show that graph bar as being from December 16th. All other dates in the image are correct.
fixed with #166
Hi, I think the issue has not been properly fixed. I have updated to the latest version (3.0.1) and it still shows the wrong date when hovering over any graph.
Hardware stats are also shifted on the session list. Latest session will always have no stats from HW logging. Instead those stats will be visible on the previous session, which is obviously not right. Here's an example:
Can you post the file with "Database Id" in ".\ExtensionsData\afbb1a0d-04a1-4d0c-9afa-c6e42ca855b4\GameActivity"?
Here are the files from the two games I showed earlier (Florence and Overwatch 2). Keep in mind that I have logged more Overwatch 2 sessions since sending the original picture. logs.zip
I have the same issue with the hardware stats. The stats for the latest session is always missing and the stats are associated with the previous session.
I am having this same issue too, I'm using MSI Afterburner as the source of my stats and it always puts my latest session with the previous session
Adding on that I am also seeing hardware stats being applied to the prior session.
I am using GameActivity 3.1.0, Playnite 10.20, MSI Afterburner 4.6.5, and RivaTuner Statistics Server 7.3.4 (ie, all up to date). RTSS is running, Afterburner is running and showing the graphs correctly during gameplay, and I have double and triple checked that the settings are correct as shown in the wiki.
Interestingly, I noticed that the JSON file seems to not be indicating the division between the prior session and the most recent session. Judging by the formatting elsewhere in the JSON file, it appears there should be a ],"2023-12-07T19:27:37.2081142Z":[
string just before the highlight in this screenshot:
The JSON file shown in the above example.
Doing a little more digging, I noticed that the session header for the most recent session is being saved into the file, but is empty - the data for the session is being saved into the wrong place. I did a little JSON surgery to correctly populate the session header with the recorded data, then restarted Playnite, and it is now correctly displaying the data for the most recent session, as shown in the below screenshot. And here is that manually edited file.
Did some more digging because this has been bugging me, and I'm finding that all records are being associated with the wrong session. In the screenshot below, the start time for the selected session lines up with a session from a month earlier. I am seeing this kind of shifting occur across all games and all sessions.
Yep, still me poking at this.
Today, I played a game new to the plugin with a first session longer than recording interval, and found that the session is saved in the JSON file, but there are no records inside of that session. There should be 16 records in this session, as my logging interval is 5 minutes. (4805/300=16 and change)
I then played again for long enough to get a couple records, and the resulting file lists the logged records under the wrong session.
It seems to me what's happening is that the session logs are being saved into the most recent session in the file before the session is created in the JSON file. In the event that a session does not exist in the JSON, the records are just lost. I tried looking through the code to confirm, but I don't know C#, so while I think I got in the vicinity of where the code performs these operations, I don't really have the expertise to pinpoint the issue or suggest a code change to fix it, sorry.
For now, I'm making a point of manually correcting the JSON file after each session. It's annoying to do, but seems to be working without issue. I'm using a script to open the most recently-modified JSON file after every session, which runs when Playnite detects the game has closed. I'll include the script here, for anyone else that's a little extra about their tracking. Note that you'll want to replace the folder location string on line 2 to reflect your own folder hierarchy:
# Specify the folder path
$folderPath = "C:\Users\<YOUR USERNAME>\AppData\Roaming\Playnite\ExtensionsData\afbb1a0d-04a1-4d0c-9afa-c6e42ca855b4\GameActivity"
# Get the most recently modified file in the folder
$recentFile = Get-ChildItem -Path $folderPath | Sort-Object LastWriteTime -Descending | Select-Object -First 1
# Check if a file was found
if ($recentFile -ne $null) {
# Open the most recently modified file
Invoke-Item $recentFile.FullName
} else {
Write-Host "No files found in the specified folder."
}
With a request from @Takarias I poked my head in at this. I think the issue stems from GameActivity.cs, Line 568. Specifically, GetLastSession()
may be returning the wrong DateTime - instead of returning the DateTime associated with the current session, it looks like it would be filtering out the 'current' session.
This is because, as far as I can tell, GetLastSession()
filters out sessions below a specific, user-configurable minimum elapsed time. However a session in progress only has its ElapsedSeconds
property set on line 1116 - so for the entirety fo the session, it is marked as having an elapsed time of zero seconds. So I believe the "current" session is not considered in GetLastSession()
and thus instead, the previous session has its activity data appended to.
I think this most likely explains why folks are seeing historical data offset between sessions, and why in checking, the SaveSession_
backup files appear to have no activity details present. This was also corroborated by @Takarias turning off the "Ignore if under length" feature and trying again with a new session on a different game - and this time, session activity details were correlated with the correct session.