fixed watched indicator for folders

pull/702/head
Luke Pulverenti 12 years ago
parent 0934a9ca76
commit a23309eb9b

@ -167,21 +167,16 @@ namespace MediaBrowser.Controller.Dto
/// <param name="fields">The fields.</param> /// <param name="fields">The fields.</param>
private async Task AttachUserSpecificInfo(BaseItemDto dto, BaseItem item, User user, List<ItemFields> fields) private async Task AttachUserSpecificInfo(BaseItemDto dto, BaseItem item, User user, List<ItemFields> fields)
{ {
if (fields.Contains(ItemFields.UserData))
{
var userData = await _userDataRepository.GetUserData(user.Id, item.GetUserDataKey()).ConfigureAwait(false);
dto.UserData = GetUserItemDataDto(userData);
}
if (item.IsFolder && fields.Contains(ItemFields.DisplayPreferencesId)) if (item.IsFolder && fields.Contains(ItemFields.DisplayPreferencesId))
{ {
dto.DisplayPreferencesId = ((Folder)item).GetDisplayPreferencesId(user.Id).ToString(); dto.DisplayPreferencesId = ((Folder)item).GetDisplayPreferencesId(user.Id).ToString();
} }
var addUserData = fields.Contains(ItemFields.UserData);
if (item.IsFolder) if (item.IsFolder)
{ {
if (fields.Contains(ItemFields.ItemCounts)) if (fields.Contains(ItemFields.ItemCounts) || addUserData)
{ {
var folder = (Folder)item; var folder = (Folder)item;
@ -191,6 +186,18 @@ namespace MediaBrowser.Controller.Dto
await SetSpecialCounts(folder, user, dto, _userDataRepository).ConfigureAwait(false); await SetSpecialCounts(folder, user, dto, _userDataRepository).ConfigureAwait(false);
} }
} }
if (addUserData)
{
var userData = await _userDataRepository.GetUserData(user.Id, item.GetUserDataKey()).ConfigureAwait(false);
dto.UserData = GetUserItemDataDto(userData);
if (item.IsFolder)
{
dto.UserData.Played = dto.PlayedPercentage.HasValue && dto.PlayedPercentage.Value >= 100;
}
}
} }
/// <summary> /// <summary>
@ -567,7 +574,7 @@ namespace MediaBrowser.Controller.Dto
// Incrememt totalPercentPlayed // Incrememt totalPercentPlayed
if (userdata != null) if (userdata != null)
{ {
if (userdata.PlayCount > 0) if (userdata.Played)
{ {
totalPercentPlayed += 100; totalPercentPlayed += 100;
} }

Loading…
Cancel
Save