Skip to content

Commit

Permalink
fix: the older or longer playtime is the one kept (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
g026r authored Oct 18, 2024
1 parent 67b5164 commit b0db1cd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/io/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ func LoadPlaytimes(root fs.FS) (map[uint32]models.PlayTime, error) {
if _, err := v.ReadFrom(f); err != nil {
return nil, err
}
if p, ok := playtimes[sig]; ok && (p.Played > v.Played || p.Added < v.Added) {
// If you have duplicate playtimes, a side effect of adding a game with the same signature, keep the older or more played
// TODO: Can we find a way to allow duplicate signatures?
continue
}
playtimes[sig] = v
}

Expand Down

0 comments on commit b0db1cd

Please sign in to comment.