< Summary - Jellyfin

Information
Class: Emby.Server.Implementations.Sorting.CriticRatingComparer
Assembly: Emby.Server.Implementations
File(s): /srv/git/jellyfin/Emby.Server.Implementations/Sorting/CriticRatingComparer.cs
Line coverage
33%
Covered lines: 1
Uncovered lines: 2
Coverable lines: 3
Total lines: 35
Line coverage: 33.3%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
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(...)0%620%

File(s)

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

#LineLine coverage
 1using Jellyfin.Data.Enums;
 2using MediaBrowser.Controller.Entities;
 3using MediaBrowser.Controller.Sorting;
 4using MediaBrowser.Model.Querying;
 5
 6namespace Emby.Server.Implementations.Sorting
 7{
 8    /// <summary>
 9    /// Class CriticRatingComparer.
 10    /// </summary>
 11    public class CriticRatingComparer : IBaseItemComparer
 12    {
 13        /// <summary>
 14        /// Gets the name.
 15        /// </summary>
 16        /// <value>The name.</value>
 117        public ItemSortBy Type => ItemSortBy.CriticRating;
 18
 19        /// <summary>
 20        /// Compares the specified x.
 21        /// </summary>
 22        /// <param name="x">The x.</param>
 23        /// <param name="y">The y.</param>
 24        /// <returns>System.Int32.</returns>
 25        public int Compare(BaseItem? x, BaseItem? y)
 26        {
 027            return GetValue(x).CompareTo(GetValue(y));
 28        }
 29
 30        private static float GetValue(BaseItem? x)
 31        {
 032            return x?.CriticRating ?? 0;
 33        }
 34    }
 35}