mirror of
https://github.com/sphildreth/roadie
synced 2024-11-22 12:13:10 +00:00
Collection Work
This commit is contained in:
parent
d9ae97f013
commit
f02e28ad58
3 changed files with 14 additions and 11 deletions
|
@ -130,13 +130,14 @@ namespace Roadie.Api.Services
|
|||
|
||||
result.Statistics = new CollectionStatistics
|
||||
{
|
||||
FileSize = collectionTracks.Sum(x => (long?)x.FileSize).ToFileSize(),
|
||||
MissingTrackCount = collectionTracks.Count(x => x.Hash != null),
|
||||
ReleaseCount = collectionReleases.Count(),
|
||||
ReleaseMediaCount = collectionReleases.Sum(x => x.MediaCount),
|
||||
Duration = collectionReleases.Sum(x => (long?)x.Duration),
|
||||
TrackCount = collectionReleases.Sum(x => x.TrackCount),
|
||||
TrackPlayedCount = collectionReleases.Sum(x => x.PlayedCount)
|
||||
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(),
|
||||
ReleaseMediaCount = collectionReleases.Sum(x => x.MediaCount),
|
||||
Duration = collectionReleases.Sum(x => (long?)x.Duration),
|
||||
TrackCount = collectionReleases.Sum(x => x.TrackCount),
|
||||
TrackPlayedCount = collectionReleases.Sum(x => x.PlayedCount)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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; }
|
||||
|
|
Loading…
Reference in a new issue