Added date last media added

This commit is contained in:
Luke Pulverenti 2014-02-10 13:43:33 -05:00
parent 013d5a467e
commit 326fa5a670

View File

@ -1213,6 +1213,7 @@ namespace MediaBrowser.Server.Implementations.Dto
var unplayed = 0;
long runtime = 0;
DateTime? dateLastMediaAdded = null;
double totalPercentPlayed = 0;
IEnumerable<BaseItem> children;
@ -1231,6 +1232,15 @@ namespace MediaBrowser.Server.Implementations.Dto
// Loop through each recursive child
foreach (var child in children)
{
if (!dateLastMediaAdded.HasValue)
{
dateLastMediaAdded = child.DateCreated;
}
else
{
dateLastMediaAdded = new[] { dateLastMediaAdded.Value, child.DateCreated }.Max();
}
var userdata = _userDataRepository.GetUserData(user.Id, child.GetUserDataKey());
recursiveItemCount++;
@ -1281,6 +1291,11 @@ namespace MediaBrowser.Server.Implementations.Dto
{
dto.CumulativeRunTimeTicks = runtime;
}
if (fields.Contains(ItemFields.DateLastMediaAdded))
{
dto.DateLastMediaAdded = dateLastMediaAdded;
}
}
/// <summary>