Stat hotfix (#1748)
* Fixed a bug where a divide by 0 could occur * Email change now requires a password
This commit is contained in:
parent
7e55134e6b
commit
3e1d0f39f0
7 changed files with 34 additions and 5 deletions
|
@ -207,24 +207,28 @@ public class StatsService : IStatsService
|
|||
private async Task<float> GetPercentageOfLibrariesWithFolderWatchingEnabled()
|
||||
{
|
||||
var libraries = (await _unitOfWork.LibraryRepository.GetLibrariesAsync()).ToList();
|
||||
if (libraries.Count == 0) return 0.0f;
|
||||
return libraries.Count(l => l.FolderWatching) / (1.0f * libraries.Count);
|
||||
}
|
||||
|
||||
private async Task<float> GetPercentageOfLibrariesIncludedInRecommended()
|
||||
{
|
||||
var libraries = (await _unitOfWork.LibraryRepository.GetLibrariesAsync()).ToList();
|
||||
if (libraries.Count == 0) return 0.0f;
|
||||
return libraries.Count(l => l.IncludeInRecommended) / (1.0f * libraries.Count);
|
||||
}
|
||||
|
||||
private async Task<float> GetPercentageOfLibrariesIncludedInDashboard()
|
||||
{
|
||||
var libraries = (await _unitOfWork.LibraryRepository.GetLibrariesAsync()).ToList();
|
||||
if (libraries.Count == 0) return 0.0f;
|
||||
return libraries.Count(l => l.IncludeInDashboard) / (1.0f * libraries.Count);
|
||||
}
|
||||
|
||||
private async Task<float> GetPercentageOfLibrariesIncludedInSearch()
|
||||
{
|
||||
var libraries = (await _unitOfWork.LibraryRepository.GetLibrariesAsync()).ToList();
|
||||
if (libraries.Count == 0) return 0.0f;
|
||||
return libraries.Count(l => l.IncludeInSearch) / (1.0f * libraries.Count);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue