Skip to content

Commit b1abf61

Browse files
committed
fix(Record): Correct version group calculation in implicit operator
1 parent 26bd4c0 commit b1abf61

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Prober/Lxns/Models/Record.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ public static implicit operator CommonRecord(Record record)
7575
{
7676
Chart chart = record.Chart;
7777
SongData songData = SongData.Shared;
78-
int versionGroup = chart.Version / 100;
78+
int versionGroup = chart.Version - (chart.Version % 100);
7979
if (!songData.VersionsByGroup.TryGetValue(versionGroup, out Version? version))
8080
{
81-
throw new InvalidDataException();
81+
throw new InvalidDataException($"Version group {versionGroup} not found");
8282
}
8383

84-
bool inCurrentGenre = songData.Versions[^1].VersionNumber / 100 == versionGroup;
84+
bool inCurrentGenre = songData.Versions[^1].VersionNumber == versionGroup;
8585

8686
return new()
8787
{

src/Prober/Lxns/Models/SongData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public record SongData
1919
public FrozenDictionary<int, Song> SongsById => field ??= Songs.ToFrozenDictionary(x => x.Id);
2020

2121
public FrozenDictionary<int, Version> VersionsByGroup => field ??=
22-
Versions.GroupBy(x => x.VersionNumber / 100).ToFrozenDictionary(x => x.Key, x => x.First());
22+
Versions.GroupBy(x => x.VersionNumber).ToFrozenDictionary(x => x.Key, x => x.First());
2323

2424
public static SongData Shared
2525
{

0 commit comments

Comments
 (0)