mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-21 02:17:20 +02:00
Chore: Some API fixes
This commit is contained in:
1 parent
f2f0b4e195
commit
d0bee3a055
5 files changed
+36
-9
No files matched your search
@@ -149,9 +149,19 @@ namespace WotBlitzStatisticsPro.Common.Model
|
||||
public decimal AvgXp => Battles == 0 ? 0m : (decimal)Xp / Battles;
|
||||
|
||||
/// <summary>
|
||||
/// All player's tanks
|
||||
/// Damage coefficient
|
||||
/// </summary>
|
||||
public List<TankInfoResponse>? Tanks { get; set; }
|
||||
public decimal DamageCoefficient => DamageReceived == 0 ? 0m : (decimal) DamageDealt / DamageReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Rate of survival
|
||||
/// </summary>
|
||||
public decimal SurvivalRate => Battles == 0 ? 0m : (decimal) 100 * SurvivedBattles / Battles;
|
||||
|
||||
/// <summary>
|
||||
/// All player's tanks
|
||||
/// </summary>
|
||||
public List<TankInfoResponse>? Tanks { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -147,6 +147,17 @@ namespace WotBlitzStatisticsPro.Common.Model
|
||||
/// </summary>
|
||||
public decimal AvgXp => (decimal) Xp / Battles;
|
||||
|
||||
/// <summary>
|
||||
/// Damage coefficient
|
||||
/// </summary>
|
||||
public decimal DamageCoefficient => DamageReceived == 0 ? 0m : (decimal)DamageDealt / DamageReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Rate of survival
|
||||
/// </summary>
|
||||
public decimal SurvivalRate => (decimal)100 * SurvivedBattles / Battles;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Tank name
|
||||
/// </summary>
|
||||
|
||||
+2
@@ -18,5 +18,7 @@ namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline
|
||||
|
||||
public AccountInfo? DbAccountInfo { get; set; }
|
||||
|
||||
// ToDo: In the future, there should be the way to skip some operations in the pipe. Now we use this dummy flag...
|
||||
public bool NeedToSaveData { get; set; }
|
||||
}
|
||||
}
|
||||
+4
-7
@@ -19,13 +19,10 @@ namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline.Operations
|
||||
{
|
||||
var contextData = context.Get<AccountInformationPipelineContextData>();
|
||||
|
||||
if (contextData.DbAccountInfo == null ||
|
||||
contextData.DbAccountInfo.LastBattleTime < contextData.AccountInfo?.LastBattleTime)
|
||||
{
|
||||
if (next != null) return next.Invoke(context);
|
||||
}
|
||||
_logger.LogInformation($"Exiting without saving. Db LastBattleTime: {contextData.DbAccountInfo?.LastBattleTime}, WG LastBattleTime: {contextData.AccountInfo?.LastBattleTime}");
|
||||
return Task.CompletedTask;
|
||||
contextData.NeedToSaveData = contextData.DbAccountInfo == null ||
|
||||
contextData.DbAccountInfo.LastBattleTime <
|
||||
contextData.AccountInfo?.LastBattleTime;
|
||||
return next != null ? next.Invoke(context) : Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -26,6 +26,13 @@ namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline.Operations
|
||||
{
|
||||
var contextData = context.Get<AccountInformationPipelineContextData>();
|
||||
|
||||
if (!contextData.NeedToSaveData)
|
||||
{
|
||||
_logger.LogInformation($"Proceeding without saving. Db LastBattleTime: {contextData.DbAccountInfo?.LastBattleTime}, WG LastBattleTime: {contextData.AccountInfo?.LastBattleTime}");
|
||||
if (next != null) await next.Invoke(context);
|
||||
return;
|
||||
}
|
||||
|
||||
if (contextData?.AccountInfo == null ||
|
||||
contextData?.AccountInfoHistory == null ||
|
||||
contextData?.Tanks == null ||
|
||||
|
||||
Reference in new issue
Block a user