< Summary - Jellyfin

Information
Class: Emby.Server.Implementations.Sorting.StartDateComparer
Assembly: Emby.Server.Implementations
File(s): /srv/git/jellyfin/Emby.Server.Implementations/Sorting/StartDateComparer.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 5
Coverable lines: 5
Total lines: 45
Line coverage: 0%
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%210%
Compare(...)100%210%
GetDate(...)0%620%

File(s)

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

#LineLine coverage
 1#pragma warning disable CS1591
 2
 3using System;
 4using Jellyfin.Data.Enums;
 5using MediaBrowser.Controller.Entities;
 6using MediaBrowser.Controller.LiveTv;
 7using MediaBrowser.Controller.Sorting;
 8
 9namespace Emby.Server.Implementations.Sorting
 10{
 11    public class StartDateComparer : IBaseItemComparer
 12    {
 13        /// <summary>
 14        /// Gets the name.
 15        /// </summary>
 16        /// <value>The name.</value>
 017        public ItemSortBy Type => ItemSortBy.StartDate;
 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 GetDate(x).CompareTo(GetDate(y));
 28        }
 29
 30        /// <summary>
 31        /// Gets the date.
 32        /// </summary>
 33        /// <param name="x">The x.</param>
 34        /// <returns>DateTime.</returns>
 35        private static DateTime GetDate(BaseItem? x)
 36        {
 037            if (x is LiveTvProgram hasStartDate)
 38            {
 039                return hasStartDate.StartDate;
 40            }
 41
 042            return DateTime.MinValue;
 43        }
 44    }
 45}