speed update, new table for cached stats

This commit is contained in:
Michael Simard
2021-08-04 16:32:17 -05:00
parent c38b621bdd
commit bc0dc93e9e
11 changed files with 485 additions and 139 deletions

29
Sources/App/Utils.swift Normal file
View File

@@ -0,0 +1,29 @@
//
// Utils.swift
// Utils
//
// Created by Michael Simard on 8/2/21.
//
import Foundation
class Utils {
static func getRatio(wins:Int, losses:Int) -> String {
var returnString = ""
let deno = (losses != 0) ? losses : 1
returnString = String(Utils.getRatioDouble(wins: wins, losses: losses))
if deno == 0 {
returnString = returnString + "+"
}
return returnString
}
static func getRatioDouble(wins:Int, losses:Int) -> Double {
let deno = (losses != 0) ? losses : 1
return (Double(wins) / Double(deno)).truncate(places: 3)
}
}