Band status.

This commit is contained in:
Steven Hildreth 2019-01-25 22:44:07 -06:00
parent 3ddbdd8a82
commit 93225b164f
3 changed files with 5 additions and 4 deletions

View file

@ -6,6 +6,6 @@
Active,
OnHold,
SplitUp,
ChangedName
Deceased,
}
}

View file

@ -628,6 +628,7 @@ namespace Roadie.Api.Services
}
tsw.Restart();
var result = artist.Adapt<Artist>();
result.BandStatus = result.BandStatus ?? BandStatus.Unknown.ToString();
result.BeginDate = result.BeginDate == null || result.BeginDate == DateTime.MinValue ? null : result.BeginDate;
result.EndDate = result.EndDate == null || result.EndDate == DateTime.MinValue ? null : result.EndDate;
result.BirthDate = result.BirthDate == null || result.BirthDate == DateTime.MinValue ? null : result.BirthDate;

View file

@ -874,16 +874,16 @@ namespace Roadie.Api.Services
where t.ArtistId == artist.Id
select (double?)ut.Rating).ToArray().Average(x => x) ?? 0;
var artistReleaseRatingSum = (from r in this.DbContext.Releases
var artistReleaseRatingRating = (from r in this.DbContext.Releases
join ur in this.DbContext.UserReleases on r.Id equals ur.ReleaseId
where r.ArtistId == artist.Id
select (double?)ur.Rating).ToArray().Average(x => x) ?? 0;
var artistReleaseRankSum = (from r in this.DbContext.Releases
where r.ArtistId == artist.Id
select r.Rank).ToArray().Average(x => x) ?? 0;
select r.Rank).ToArray().Sum(x => x) ?? 0;
artist.Rank = SafeParser.ToNumber<decimal>(artistTrackAverage + artistReleaseRatingSum) + artistReleaseRankSum + artist.Rating;
artist.Rank = SafeParser.ToNumber<decimal>(artistTrackAverage + artistReleaseRatingRating) + artistReleaseRankSum + artist.Rating;
await this.DbContext.SaveChangesAsync();
this.CacheManager.ClearRegion(artist.CacheRegion);