mirror of
https://github.com/sphildreth/roadie
synced 2024-11-10 06:44:12 +00:00
Band status.
This commit is contained in:
parent
3ddbdd8a82
commit
93225b164f
3 changed files with 5 additions and 4 deletions
|
@ -6,6 +6,6 @@
|
|||
Active,
|
||||
OnHold,
|
||||
SplitUp,
|
||||
ChangedName
|
||||
Deceased,
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue