You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.7 KiB
53 lines
1.7 KiB
//
|
|
// TournamentWinner.swift
|
|
// TournamentStats
|
|
//
|
|
// Created by Laurent Morvillier on 04/06/2019.
|
|
// Copyright © 2019 Stax River. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
struct TournamentWinner : HTMLRepresentable {
|
|
|
|
var tournament: Tournament
|
|
var result: Result
|
|
|
|
func columnDescriptors() -> [ColumnDescriptor] {
|
|
return [
|
|
ColumnDescriptor(header: "Buy-in", number: true, widthWeight: 0.5),
|
|
ColumnDescriptor(header: "Event", number: false, widthWeight: 3.0),
|
|
ColumnDescriptor(header: "Player", number: false, widthWeight: 1.0),
|
|
ColumnDescriptor(header: "Prize", number: true, widthWeight: 1.0)]
|
|
}
|
|
|
|
func cellValues() -> [String] {
|
|
return [
|
|
tournament.buyin.currencyFormatted,
|
|
tournament.name,
|
|
result.player?.formattedName ?? "",
|
|
result.earnings.currencyFormatted
|
|
]
|
|
}
|
|
|
|
func htmlHeaders() -> String {
|
|
var header = ""
|
|
header.append("<td width=\"100\">Buy-in</td>")
|
|
header.append("<td>Event</td>")
|
|
header.append("<td>Player</td>")
|
|
header.append("<td width=\"130\">Prize</td>")
|
|
return "<tr class=\"table-header\">\(header)</tr>"
|
|
}
|
|
|
|
// func html() -> String {
|
|
// var strings: [String] = []
|
|
// strings.append("\(tournament.number)")
|
|
// strings.append(tournament.buyin.currencyFormatted)
|
|
// strings.append(tournament.name)
|
|
// strings.append(result.player?.formattedName ?? "")
|
|
// strings.append(result.earnings.currencyFormatted)
|
|
// let all = strings.joined(separator: "</td><td>")
|
|
// return "<tr><td>\(all)</td></tr>"
|
|
// }
|
|
|
|
}
|
|
|