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.
41 lines
1.3 KiB
41 lines
1.3 KiB
//
|
|
// PlayerResult.swift
|
|
// TournamentStats
|
|
//
|
|
// Created by Laurent Morvillier on 04/06/2019.
|
|
// Copyright © 2019 Stax River. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
struct PlayerResult : HTMLRepresentable {
|
|
|
|
var tournament: Tournament
|
|
var result: Result
|
|
|
|
func columnDescriptors() -> [ColumnDescriptor] {
|
|
return [ColumnDescriptor(header: "Player", number: false, widthWeight: 1.0),
|
|
ColumnDescriptor(header: "Place", number: true, widthWeight: 1.0),
|
|
ColumnDescriptor(header: "Earnings", number: true, widthWeight: 1.0),
|
|
ColumnDescriptor(header: "Event", number: false, widthWeight: 1.0)]
|
|
}
|
|
|
|
func cellValues() -> [String] {
|
|
return [
|
|
self.result.player?.formattedName ?? "",
|
|
self.result.rank.rankFormatted,
|
|
result.earnings.currencyFormatted,
|
|
"\(tournament.name)"
|
|
]
|
|
}
|
|
|
|
func htmlHeaders() -> String {
|
|
var strings: String = ""
|
|
strings.append("<td width=\"30%\">Player</td>")
|
|
strings.append("<td width=\"80\">Place</td>")
|
|
strings.append("<td width=\"125\">Earnings</td>")
|
|
strings.append("<td>Event</td>")
|
|
return "<tr class=\"table-header\">\(strings)</tr>"
|
|
}
|
|
|
|
}
|
|
|