You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.0 KiB
44 lines
1.0 KiB
4 years ago
|
using NzbDrone.Core.AuthorStats;
|
||
7 years ago
|
|
||
4 years ago
|
namespace Readarr.Api.V1.Books
|
||
7 years ago
|
{
|
||
4 years ago
|
public class BookStatisticsResource
|
||
7 years ago
|
{
|
||
4 years ago
|
public int BookFileCount { get; set; }
|
||
4 years ago
|
public int BookCount { get; set; }
|
||
7 years ago
|
public int TotalTrackCount { get; set; }
|
||
|
public long SizeOnDisk { get; set; }
|
||
|
|
||
|
public decimal PercentOfTracks
|
||
|
{
|
||
|
get
|
||
|
{
|
||
4 years ago
|
if (BookCount == 0)
|
||
5 years ago
|
{
|
||
|
return 0;
|
||
|
}
|
||
7 years ago
|
|
||
4 years ago
|
return BookFileCount / (decimal)BookCount * 100;
|
||
7 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
4 years ago
|
public static class BookStatisticsResourceMapper
|
||
7 years ago
|
{
|
||
4 years ago
|
public static BookStatisticsResource ToResource(this BookStatistics model)
|
||
7 years ago
|
{
|
||
5 years ago
|
if (model == null)
|
||
|
{
|
||
|
return null;
|
||
|
}
|
||
7 years ago
|
|
||
4 years ago
|
return new BookStatisticsResource
|
||
7 years ago
|
{
|
||
4 years ago
|
BookFileCount = model.BookFileCount,
|
||
4 years ago
|
BookCount = model.BookCount,
|
||
7 years ago
|
SizeOnDisk = model.SizeOnDisk
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
}
|