Skip to content

Commit 45e5a1d

Browse files
committed
Correctly create percentages
Some API endpoints return values between 0 and 100, others between 0 and 1. We previously used the latter which didn't work when switching to the former that resulted in always showing 100%.
1 parent 95d6d94 commit 45e5a1d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/NexusMods.App.UI/Pages/CollectionDownload/CollectionDownloadViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ private async ValueTask InstallItem(CollectionDownloadEntity.ReadOnly download,
442442
public ulong TotalDownloads => _collection.TotalDownloads.ValueOr(0ul);
443443
public string Category => _collection.Category.Name;
444444
public Size TotalSize => _revision.TotalSize.ValueOr(Size.Zero);
445-
public Percent OverallRating => Percent.CreateClamped(_revision.Collection.RecentRating.ValueOr(0));
445+
public Percent OverallRating => Percent.Create(_revision.Collection.RecentRating.ValueOr(0), maximum: 100);
446446

447447
public string AuthorName => _collection.Author.Name;
448448
public bool IsAdult => _revision.IsAdult.ValueOr(false);

src/NexusMods.App.UI/Pages/LibraryPage/Collections/CollectionCardViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public CollectionCardViewModel(
8585
public ulong EndorsementCount => _collection.Endorsements.ValueOr(0ul);
8686
public ulong TotalDownloads => _collection.TotalDownloads.ValueOr(0ul);
8787
public Size TotalSize => _revision.TotalSize.ValueOr(Size.Zero);
88-
public Percent OverallRating => Percent.CreateClamped(_revision.Collection.RecentRating.ValueOr(0));
88+
public Percent OverallRating => Percent.Create(_revision.Collection.RecentRating.ValueOr(0), maximum: 100);
8989

9090
public bool IsAdult => _revision.IsAdult.ValueOr(false);
9191
public string AuthorName => _collection.Author.Name;

0 commit comments

Comments
 (0)