/// <summary> /// Report Mutant Stats /// </summary> /// <returns>The Mutant Stasts Class</returns> public async Task <MutantStats> StatsMutant() { var resultSearchMutant = await _mutantRepository .Where("isMutant = true") .ConfigureAwait(false); var resultSearchNotMutant = await _mutantRepository .Where("isMutant = false") .ConfigureAwait(false); double ratio = resultSearchMutant.Count() / (resultSearchNotMutant.Count() == 0 ? 1 : resultSearchNotMutant.Count()); var stats = new MutantStats { count_human_dna = resultSearchNotMutant.Count(), count_mutant_dna = resultSearchMutant.Count(), ratio = ratio }; return(stats); }
public StatsResponse(MutantStats mutantStats) { Mutants = mutantStats.Mutants; Humans = mutantStats.Humans; Ratio = mutantStats.Ratio; }