< Summary - Jellyfin

Information
Class: Emby.Server.Implementations.Sorting.IsPlayedComparer
Assembly: Emby.Server.Implementations
File(s): /srv/git/jellyfin/Emby.Server.Implementations/Sorting/IsPlayedComparer.cs
Line coverage
33%
Covered lines: 1
Uncovered lines: 2
Coverable lines: 3
Total lines: 61
Line coverage: 33.3%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Type()100%11100%
Compare(...)100%210%
GetValue(...)100%210%

File(s)

/srv/git/jellyfin/Emby.Server.Implementations/Sorting/IsPlayedComparer.cs

#LineLine coverage
 1#nullable disable
 2
 3#pragma warning disable CS1591
 4
 5using Jellyfin.Data.Entities;
 6using Jellyfin.Data.Enums;
 7using MediaBrowser.Controller.Entities;
 8using MediaBrowser.Controller.Library;
 9using MediaBrowser.Controller.Sorting;
 10using MediaBrowser.Model.Querying;
 11
 12namespace Emby.Server.Implementations.Sorting
 13{
 14    public class IsPlayedComparer : IUserBaseItemComparer
 15    {
 16        /// <summary>
 17        /// Gets or sets the user.
 18        /// </summary>
 19        /// <value>The user.</value>
 20        public User User { get; set; }
 21
 22        /// <summary>
 23        /// Gets the name.
 24        /// </summary>
 25        /// <value>The name.</value>
 126        public ItemSortBy Type => ItemSortBy.IsUnplayed;
 27
 28        /// <summary>
 29        /// Gets or sets the user data repository.
 30        /// </summary>
 31        /// <value>The user data repository.</value>
 32        public IUserDataManager UserDataRepository { get; set; }
 33
 34        /// <summary>
 35        /// Gets or sets the user manager.
 36        /// </summary>
 37        /// <value>The user manager.</value>
 38        public IUserManager UserManager { get; set; }
 39
 40        /// <summary>
 41        /// Compares the specified x.
 42        /// </summary>
 43        /// <param name="x">The x.</param>
 44        /// <param name="y">The y.</param>
 45        /// <returns>System.Int32.</returns>
 46        public int Compare(BaseItem x, BaseItem y)
 47        {
 048            return GetValue(x).CompareTo(GetValue(y));
 49        }
 50
 51        /// <summary>
 52        /// Gets the date.
 53        /// </summary>
 54        /// <param name="x">The x.</param>
 55        /// <returns>DateTime.</returns>
 56        private int GetValue(BaseItem x)
 57        {
 058            return x.IsPlayed(User) ? 0 : 1;
 59        }
 60    }
 61}