Collection Work

This commit is contained in:
Steven Hildreth 2018-12-11 08:08:34 -06:00
parent d9ae97f013
commit f02e28ad58
3 changed files with 14 additions and 11 deletions

View file

@ -130,6 +130,7 @@ namespace Roadie.Api.Services
result.Statistics = new CollectionStatistics
{
ArtistCount = collectionReleases.Select(x => x.ArtistId).Distinct().Count(),
FileSize = collectionTracks.Sum(x => (long?)x.FileSize).ToFileSize(),
MissingTrackCount = collectionTracks.Count(x => x.Hash != null),
ReleaseCount = collectionReleases.Count(),

View file

@ -134,7 +134,8 @@ namespace Roadie.Api.Services
join c in this.DbContext.Collections on cr.CollectionId equals c.Id
join r in this.DbContext.Releases on cr.ReleaseId equals r.Id
where c.RoadieId == request.FilterToCollectionId.Value
select r.Id).ToArray();
orderby cr.ListNumber
select r.Id).Skip(request.SkipValue).Take(request.LimitValue).ToArray();
}
int[] favoriteReleaseIds = new int[0];
@ -289,7 +290,7 @@ namespace Roadie.Api.Services
where collectionReleaseIds.Contains(cr.ReleaseId)
orderby cr.ListNumber
select cr);
foreach (var par in collection.PositionArtistReleases())
foreach (var par in collection.PositionArtistReleases().OrderBy(x => x.Index).Skip(request.SkipValue).Take(request.LimitValue))
{
var cr = collectionReleases.FirstOrDefault(x => x.ListNumber == par.Position);
// Release is known for Collection CSV, find newRow and update ListNumber
@ -331,8 +332,8 @@ namespace Roadie.Api.Services
}
}
// Resort the list for the collection by listNumber
rows = newRows.OrderBy(x => x.ListNumber).Skip(request.SkipValue).Take(request.LimitValue).ToArray();
rowCount = newRows.Count();
rows = newRows.OrderBy(x => x.ListNumber).ToArray();
rowCount = collection.CollectionCount;
}
if (roadieUser != null)

View file

@ -6,6 +6,7 @@ namespace Roadie.Library.Models.Statistics
[Serializable]
public class CollectionStatistics
{
public int? ArtistCount { get; set; }
public string FileSize { get; set; }
public int? MissingTrackCount { get; set; }
public int? ReleaseCount { get; set; }