< Summary - Jellyfin

Information
Class: Jellyfin.Data.Entities.Libraries.Rating
Assembly: Jellyfin.Data
File(s): /srv/git/jellyfin/Jellyfin.Data/Entities/Libraries/Rating.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 4
Coverable lines: 4
Total lines: 59
Line coverage: 0%
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
.ctor(...)100%210%
OnSavingChanges()100%210%

File(s)

/srv/git/jellyfin/Jellyfin.Data/Entities/Libraries/Rating.cs

#LineLine coverage
 1using System.ComponentModel.DataAnnotations;
 2using System.ComponentModel.DataAnnotations.Schema;
 3using Jellyfin.Data.Interfaces;
 4
 5namespace Jellyfin.Data.Entities.Libraries
 6{
 7    /// <summary>
 8    /// An entity representing a rating for an entity.
 9    /// </summary>
 10    public class Rating : IHasConcurrencyToken
 11    {
 12        /// <summary>
 13        /// Initializes a new instance of the <see cref="Rating"/> class.
 14        /// </summary>
 15        /// <param name="value">The value.</param>
 16        public Rating(double value)
 17        {
 018            Value = value;
 019        }
 20
 21        /// <summary>
 22        /// Gets the id.
 23        /// </summary>
 24        /// <remarks>
 25        /// Identity, Indexed, Required.
 26        /// </remarks>
 27        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
 28        public int Id { get; private set; }
 29
 30        /// <summary>
 31        /// Gets or sets the value.
 32        /// </summary>
 33        /// <remarks>
 34        /// Required.
 35        /// </remarks>
 36        public double Value { get; set; }
 37
 38        /// <summary>
 39        /// Gets or sets the number of votes.
 40        /// </summary>
 41        public int? Votes { get; set; }
 42
 43        /// <inheritdoc />
 44        [ConcurrencyCheck]
 45        public uint RowVersion { get; private set; }
 46
 47        /// <summary>
 48        /// Gets or sets the rating type.
 49        /// If this is <c>null</c> it's the internal user rating.
 50        /// </summary>
 51        public virtual RatingSource? RatingType { get; set; }
 52
 53        /// <inheritdoc />
 54        public void OnSavingChanges()
 55        {
 056            RowVersion++;
 057        }
 58    }
 59}