From dae169f250993e1a94e39095d31a58920d4def5b Mon Sep 17 00:00:00 2001 From: Michael Simard Date: Sat, 20 Jun 2020 13:21:18 -0500 Subject: [PATCH] Real date as label --- Sources/App/Controllers/StatsController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/App/Controllers/StatsController.swift b/Sources/App/Controllers/StatsController.swift index c828169..03c3e64 100644 --- a/Sources/App/Controllers/StatsController.swift +++ b/Sources/App/Controllers/StatsController.swift @@ -377,7 +377,9 @@ struct StatsController: RouteCollection { let date = self.createDate(day: first.day, month: first.month, year: first.year, hour: first.hour + 6, minute:first.minute) // 6 hours to make sure we pick a time that isnt on borders of us time zones print ("p \(date.timeIntervalSince1970)") let x = Double(cumulativeWinLossRatios.count) - cumulativeWinLossRatios.append(DataPoint(x:x , y: (totalWins/totalLosses).truncate(places: 2), label:"\(date.timeIntervalSince1970*1000)")) + + let d = Date(timeIntervalSince1970: date.timeIntervalSince1970) + cumulativeWinLossRatios.append(DataPoint(x:x , y: (totalWins/totalLosses).truncate(places: 2), label:("\(Utilities.monthToString(month: d.month)) \(d.day)"))) } allDailyStats.append(DailyStats(day: first.day, month: first.month, year: first.year, stats: stats, cumulativeRatio: self.getRatio(num: totalWins, den: totalLosses))) return getRatios(remaining, allDailyStats:&allDailyStats, cumulativeWinLossRatios:&cumulativeWinLossRatios, eventLoop: eventLoop)