mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-24 20:00:05 +02:00
Added tanks stat info operation and calculation tier and Wn7 operation
This commit is contained in:
1 parent
3eeda15491
commit
b343e36e0d
14 files changed
+394
-4
No files matched your search
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using WotBlitzStatisticsPro.DataAccess.Model.Accounts;
|
||||
|
||||
namespace WotBlitzStatisticsPro.Logic.Calculations
|
||||
{
|
||||
public static class TierHelper
|
||||
{
|
||||
public static void CalculateMiddleTier(this AccountInfoHistory account, IList<TankInfoHistory> allTanks, Dictionary<long, int> tankTires)
|
||||
{
|
||||
double x = 0d;
|
||||
if (!account.Battles.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (var tank in allTanks)
|
||||
{
|
||||
if (tankTires.ContainsKey(tank.TankId) && tank.Battles.HasValue && tank.Battles > 0)
|
||||
{
|
||||
x += tankTires[tank.TankId] * tank.Battles.Value;
|
||||
}
|
||||
}
|
||||
if (account.Battles > 0)
|
||||
x /= account.Battles.Value;
|
||||
account.AvgTier = x;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user