Skip to content

Commit 1943cf3

Browse files
committed
Fix epic photo fails, improve subject bound parser exception messages
1 parent 301e90f commit 1943cf3

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

Refresh.Database/GameDatabaseContext.Photos.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ public partial class GameDatabaseContext // Photos
3131
.Include(p => p.Photo!.Publisher.Statistics)
3232
.Include(p => p.Photo!.Level)
3333
.Include(p => p.Photo!.Level!.Publisher)
34-
.Include(p => p.Photo!.Level!.Publisher!.Statistics);
34+
.Include(p => p.Photo!.Level!.Publisher!.Statistics)
35+
.Include(p => p.Photo!.LargeAsset)
36+
.Include(p => p.Photo!.MediumAsset)
37+
.Include(p => p.Photo!.SmallAsset);
3538

3639
public GamePhoto UploadPhoto(IPhotoUpload photo, IEnumerable<IPhotoUploadSubject> subjects, GameUser publisher, GameLevel? level)
3740
{
@@ -85,7 +88,7 @@ public GamePhoto UploadPhoto(IPhotoUpload photo, IEnumerable<IPhotoUploadSubject
8588
}
8689
catch (Exception ex)
8790
{
88-
this._logger.LogWarning(BunkumCategory.UserPhotos, $"Could not parse {subject.DisplayName}'s photo bounds: {ex.GetType()} {ex.Message}");
91+
this._logger.LogWarning(BunkumCategory.UserPhotos, $"Could not parse {subject.DisplayName}'s photo bounds: {ex.GetType()} - {ex.Message}");
8992
}
9093

9194
GameUser? subjectUser = string.IsNullOrWhiteSpace(subject.Username) ? null : this.GetUserByUsername(subject.Username);
@@ -179,7 +182,7 @@ public void MigratePhotoSubjects(GamePhoto photo, bool saveChanges)
179182

180183
public void RemovePhoto(GamePhoto photo)
181184
{
182-
foreach (GameUser subjectUser in this.GetUsersInPhoto(photo))
185+
foreach (GameUser subjectUser in this.GetUsersInPhoto(photo).ToArray())
183186
{
184187
this.WriteEnsuringStatistics(subjectUser, () =>
185188
{

Refresh.Database/Helpers/PhotoHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static float[] ParseBoundsList(string input)
2222
string boundaryStr = boundsStr[i];
2323

2424
if (!float.TryParse(boundaryStr, NumberFormatInfo.InvariantInfo, out float f))
25-
throw new FormatException($"Boundary {boundaryStr} ({i+1}/{SubjectBoundaryCount}) is not a float");
25+
throw new FormatException($"Boundary '{boundaryStr}' ({i+1}/{SubjectBoundaryCount}) is not a float");
2626

2727
boundsParsed[i] = f;
2828
}

0 commit comments

Comments
 (0)