< Summary - Jellyfin

Information
Class: Emby.Server.Implementations.Sorting.CommunityRatingComparer
Assembly: Emby.Server.Implementations
File(s): /srv/git/jellyfin/Emby.Server.Implementations/Sorting/CommunityRatingComparer.cs
Line coverage
25%
Covered lines: 1
Uncovered lines: 3
Coverable lines: 4
Total lines: 34
Line coverage: 25%
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%

File(s)

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

#LineLine coverage
 1#pragma warning disable CS1591
 2
 3using System;
 4using Jellyfin.Data.Enums;
 5using MediaBrowser.Controller.Entities;
 6using MediaBrowser.Controller.Sorting;
 7using MediaBrowser.Model.Querying;
 8
 9namespace Emby.Server.Implementations.Sorting
 10{
 11    public class CommunityRatingComparer : IBaseItemComparer
 12    {
 13        /// <summary>
 14        /// Gets the name.
 15        /// </summary>
 16        /// <value>The name.</value>
 117        public ItemSortBy Type => ItemSortBy.CommunityRating;
 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            ArgumentNullException.ThrowIfNull(x);
 28
 029            ArgumentNullException.ThrowIfNull(y);
 30
 031            return (x.CommunityRating ?? 0).CompareTo(y.CommunityRating ?? 0);
 32        }
 33    }
 34}