hopefully final tz tweaks

This commit is contained in:
Michael Simard
2020-06-16 22:52:36 -05:00
parent 42a1b2f4ec
commit 00ddf6167c

View File

@@ -73,7 +73,6 @@ struct StatsController: RouteCollection {
func getStatsForDay(year:Int, month:Int, day:Int, req: Request) -> EventLoopFuture<Stats>{ func getStatsForDay(year:Int, month:Int, day:Int, req: Request) -> EventLoopFuture<Stats>{
let winCount = Match.query(on: req.db) let winCount = Match.query(on: req.db)
.filter(\.$date >= getStartOfDay(day:day, month: month, year: year)) .filter(\.$date >= getStartOfDay(day:day, month: month, year: year))
.filter(\.$date <= getEndOfDay(day: day, month: month, year: year)) .filter(\.$date <= getEndOfDay(day: day, month: month, year: year))
@@ -180,7 +179,7 @@ struct StatsController: RouteCollection {
let calendar = Calendar.current let calendar = Calendar.current
var components = DateComponents() var components = DateComponents()
components.timeZone = TimeZone(identifier: "GMT") components.timeZone = TimeZone(identifier: "GMT")
components.day = 20 components.day = 10
components.month = 03 components.month = 03
components.year = 2020 components.year = 2020
components.hour = 4 components.hour = 4
@@ -362,7 +361,7 @@ struct StatsController: RouteCollection {
var cumulativeWinLossRatios = cumulativeWinLossRatios var cumulativeWinLossRatios = cumulativeWinLossRatios
if !(stats.totalWins == 0 && stats.totalLosses == 0) { if !(stats.totalWins == 0 && stats.totalLosses == 0) {
let date = self.createDate(day: first.day, month: first.month, year: first.year, hour: first.hour, minute:first.minute) 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)") print ("p \(date.timeIntervalSince1970)")
cumulativeWinLossRatios.append(DataPoint(x:date.timeIntervalSince1970*1000 , y: (totalWins/totalLosses).truncate(places: 2))) cumulativeWinLossRatios.append(DataPoint(x:date.timeIntervalSince1970*1000 , y: (totalWins/totalLosses).truncate(places: 2)))
} }