diff --git a/Framework/DiscordRewards/GiveRewardsCommand.cs b/Framework/DiscordRewards/GiveRewardsCommand.cs index 9617633..48dabcc 100644 --- a/Framework/DiscordRewards/GiveRewardsCommand.cs +++ b/Framework/DiscordRewards/GiveRewardsCommand.cs @@ -16,7 +16,7 @@ public class MarketAverage { public int NumberOfFinished { get; set; } - public TimeSpan TimeRange { get; set; } + public int TimeRangeSeconds { get; set; } public float Price { get; set; } public float Size { get; set; } public float Duration { get; set; } diff --git a/Tools/BiblioTech/Commands/MarketCommand.cs b/Tools/BiblioTech/Commands/MarketCommand.cs index 9289181..0df58d5 100644 --- a/Tools/BiblioTech/Commands/MarketCommand.cs +++ b/Tools/BiblioTech/Commands/MarketCommand.cs @@ -31,7 +31,8 @@ namespace BiblioTech.Commands private string[] GetInsight(MarketAverage avg) { - var headerLine = $"[Last {Time.FormatDuration(avg.TimeRange)}] ({avg.NumberOfFinished} Contracts finished)"; + var timeRange = TimeSpan.FromSeconds(avg.TimeRangeSeconds); + var headerLine = $"[Last {Time.FormatDuration(timeRange)}] ({avg.NumberOfFinished} Contracts finished)"; if (avg.NumberOfFinished == 0) { diff --git a/Tools/TestNetRewarder/MarketTracker.cs b/Tools/TestNetRewarder/MarketTracker.cs index e22c141..17e5e82 100644 --- a/Tools/TestNetRewarder/MarketTracker.cs +++ b/Tools/TestNetRewarder/MarketTracker.cs @@ -53,7 +53,7 @@ namespace TestNetRewarder return new MarketAverage { NumberOfFinished = CountNumberOfFinishedRequests(states), - TimeRange = GetTotalTimeRange(states), + TimeRangeSeconds = GetTotalTimeRange(states), Price = Average(states, s => s.Request.Ask.Reward), Duration = Average(states, s => s.Request.Ask.Duration), Size = Average(states, s => GetTotalSize(s.Request.Ask)), @@ -93,12 +93,13 @@ namespace TestNetRewarder } } + if (count < 1.0f) return 0.0f; return sum / count; } - private TimeSpan GetTotalTimeRange(ChainState[] states) + private int GetTotalTimeRange(ChainState[] states) { - return Program.Config.Interval * states.Length; + return Convert.ToInt32((Program.Config.Interval * states.Length).TotalSeconds); } private int CountNumberOfFinishedRequests(ChainState[] states)