mirror of
https://github.com/sphildreth/roadie
synced 2024-11-25 21:50:22 +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
|
result.Statistics = new CollectionStatistics
|
||||||
{
|
{
|
||||||
FileSize = collectionTracks.Sum(x => (long?)x.FileSize).ToFileSize(),
|
ArtistCount = collectionReleases.Select(x => x.ArtistId).Distinct().Count(),
|
||||||
MissingTrackCount = collectionTracks.Count(x => x.Hash != null),
|
FileSize = collectionTracks.Sum(x => (long?)x.FileSize).ToFileSize(),
|
||||||
ReleaseCount = collectionReleases.Count(),
|
MissingTrackCount = collectionTracks.Count(x => x.Hash != null),
|
||||||
ReleaseMediaCount = collectionReleases.Sum(x => x.MediaCount),
|
ReleaseCount = collectionReleases.Count(),
|
||||||
Duration = collectionReleases.Sum(x => (long?)x.Duration),
|
ReleaseMediaCount = collectionReleases.Sum(x => x.MediaCount),
|
||||||
TrackCount = collectionReleases.Sum(x => x.TrackCount),
|
Duration = collectionReleases.Sum(x => (long?)x.Duration),
|
||||||
TrackPlayedCount = collectionReleases.Sum(x => x.PlayedCount)
|
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 c in this.DbContext.Collections on cr.CollectionId equals c.Id
|
||||||
join r in this.DbContext.Releases on cr.ReleaseId equals r.Id
|
join r in this.DbContext.Releases on cr.ReleaseId equals r.Id
|
||||||
where c.RoadieId == request.FilterToCollectionId.Value
|
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];
|
int[] favoriteReleaseIds = new int[0];
|
||||||
|
@ -289,7 +290,7 @@ namespace Roadie.Api.Services
|
||||||
where collectionReleaseIds.Contains(cr.ReleaseId)
|
where collectionReleaseIds.Contains(cr.ReleaseId)
|
||||||
orderby cr.ListNumber
|
orderby cr.ListNumber
|
||||||
select cr);
|
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);
|
var cr = collectionReleases.FirstOrDefault(x => x.ListNumber == par.Position);
|
||||||
// Release is known for Collection CSV, find newRow and update ListNumber
|
// 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
|
// Resort the list for the collection by listNumber
|
||||||
rows = newRows.OrderBy(x => x.ListNumber).Skip(request.SkipValue).Take(request.LimitValue).ToArray();
|
rows = newRows.OrderBy(x => x.ListNumber).ToArray();
|
||||||
rowCount = newRows.Count();
|
rowCount = collection.CollectionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roadieUser != null)
|
if (roadieUser != null)
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace Roadie.Library.Models.Statistics
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class CollectionStatistics
|
public class CollectionStatistics
|
||||||
{
|
{
|
||||||
|
public int? ArtistCount { get; set; }
|
||||||
public string FileSize { get; set; }
|
public string FileSize { get; set; }
|
||||||
public int? MissingTrackCount { get; set; }
|
public int? MissingTrackCount { get; set; }
|
||||||
public int? ReleaseCount { get; set; }
|
public int? ReleaseCount { get; set; }
|
||||||
|
|
Loading…
Reference in a new issue