updated data + added a chip count % calculator

master
Laurent 6 years ago
parent 02449fd472
commit 54f30cb527
  1. 38
      TournamentStats.xcodeproj/project.pbxproj
  2. 16
      TournamentStats.xcodeproj/xcuserdata/laurent.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  3. 15
      TournamentStats/Base.lproj/Main.storyboard
  4. 95
      TournamentStats/ChipCountParser.swift
  5. 79
      TournamentStats/Events/chipcount
  6. 217
      TournamentStats/Events/event2 copie 13
  7. 217
      TournamentStats/Events/event2 copie 14
  8. 6335
      TournamentStats/Events/event50
  9. 2262
      TournamentStats/Events/event57
  10. 5
      TournamentStats/Seed.swift
  11. 45
      TournamentStats/UI/MasterViewController.swift
  12. 2
      TournamentStats/realm/Model.swift
  13. 28
      TournamentStats/report/structures/ChipCount.swift

@ -7,6 +7,9 @@
objects = {
/* Begin PBXBuildFile section */
4D0F103522C4C04F005F797A /* chipcount in Resources */ = {isa = PBXBuildFile; fileRef = 4D0F103422C4C04F005F797A /* chipcount */; };
4D0F103722C4C08F005F797A /* ChipCount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D0F103622C4C08F005F797A /* ChipCount.swift */; };
4D0F103922C4C1C4005F797A /* ChipCountParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D0F103822C4C1C4005F797A /* ChipCountParser.swift */; };
4D18861122C36D8F0020C4CD /* TournamentCounter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D18861022C36D8F0020C4CD /* TournamentCounter.swift */; };
4DA5CA1E22AD078A00AC628E /* CountryCounter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DA5CA1D22AD078A00AC628E /* CountryCounter.swift */; };
4DDEF11422AE4FB900F4D7C1 /* TournamentStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DDEF11322AE4FB900F4D7C1 /* TournamentStats.swift */; };
@ -34,10 +37,10 @@
4DF7610822A56797004B0EF1 /* event3 copie 10 in Resources */ = {isa = PBXBuildFile; fileRef = 4DF760CC22A56793004B0EF1 /* event3 copie 10 */; };
4DF7610922A56797004B0EF1 /* event28 in Resources */ = {isa = PBXBuildFile; fileRef = 4DF760CD22A56793004B0EF1 /* event28 */; };
4DF7610A22A56797004B0EF1 /* event32 in Resources */ = {isa = PBXBuildFile; fileRef = 4DF760CE22A56793004B0EF1 /* event32 */; };
4DF7610B22A56797004B0EF1 /* event2 copie 13 in Resources */ = {isa = PBXBuildFile; fileRef = 4DF760CF22A56793004B0EF1 /* event2 copie 13 */; };
4DF7610B22A56797004B0EF1 /* event50 in Resources */ = {isa = PBXBuildFile; fileRef = 4DF760CF22A56793004B0EF1 /* event50 */; };
4DF7610C22A56797004B0EF1 /* event7 in Resources */ = {isa = PBXBuildFile; fileRef = 4DF760D022A56793004B0EF1 /* event7 */; };
4DF7610D22A56797004B0EF1 /* event55 in Resources */ = {isa = PBXBuildFile; fileRef = 4DF760D122A56793004B0EF1 /* event55 */; };
4DF7610E22A56797004B0EF1 /* event2 copie 14 in Resources */ = {isa = PBXBuildFile; fileRef = 4DF760D222A56793004B0EF1 /* event2 copie 14 */; };
4DF7610E22A56797004B0EF1 /* event57 in Resources */ = {isa = PBXBuildFile; fileRef = 4DF760D222A56793004B0EF1 /* event57 */; };
4DF7610F22A56797004B0EF1 /* event2 copie 15 in Resources */ = {isa = PBXBuildFile; fileRef = 4DF760D322A56793004B0EF1 /* event2 copie 15 */; };
4DF7611022A56797004B0EF1 /* event9 in Resources */ = {isa = PBXBuildFile; fileRef = 4DF760D422A56793004B0EF1 /* event9 */; };
4DF7611122A56797004B0EF1 /* event3 copie 12 in Resources */ = {isa = PBXBuildFile; fileRef = 4DF760D522A56794004B0EF1 /* event3 copie 12 */; };
@ -113,6 +116,9 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
4D0F103422C4C04F005F797A /* chipcount */ = {isa = PBXFileReference; lastKnownFileType = text; path = chipcount; sourceTree = "<group>"; };
4D0F103622C4C08F005F797A /* ChipCount.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipCount.swift; sourceTree = "<group>"; };
4D0F103822C4C1C4005F797A /* ChipCountParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipCountParser.swift; sourceTree = "<group>"; };
4D18861022C36D8F0020C4CD /* TournamentCounter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TournamentCounter.swift; sourceTree = "<group>"; };
4DA5CA1D22AD078A00AC628E /* CountryCounter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountryCounter.swift; sourceTree = "<group>"; };
4DDEF11322AE4FB900F4D7C1 /* TournamentStats.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TournamentStats.swift; sourceTree = "<group>"; };
@ -144,10 +150,10 @@
4DF760CC22A56793004B0EF1 /* event3 copie 10 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "event3 copie 10"; sourceTree = "<group>"; };
4DF760CD22A56793004B0EF1 /* event28 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event28; sourceTree = "<group>"; };
4DF760CE22A56793004B0EF1 /* event32 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event32; sourceTree = "<group>"; };
4DF760CF22A56793004B0EF1 /* event2 copie 13 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "event2 copie 13"; sourceTree = "<group>"; };
4DF760CF22A56793004B0EF1 /* event50 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event50; sourceTree = "<group>"; };
4DF760D022A56793004B0EF1 /* event7 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event7; sourceTree = "<group>"; };
4DF760D122A56793004B0EF1 /* event55 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event55; sourceTree = "<group>"; };
4DF760D222A56793004B0EF1 /* event2 copie 14 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "event2 copie 14"; sourceTree = "<group>"; };
4DF760D222A56793004B0EF1 /* event57 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event57; sourceTree = "<group>"; };
4DF760D322A56793004B0EF1 /* event2 copie 15 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "event2 copie 15"; sourceTree = "<group>"; };
4DF760D422A56793004B0EF1 /* event9 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event9; sourceTree = "<group>"; };
4DF760D522A56794004B0EF1 /* event3 copie 12 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "event3 copie 12"; sourceTree = "<group>"; };
@ -261,6 +267,7 @@
4DF760C322A56207004B0EF1 /* utils */,
4DF7614422A593FC004B0EF1 /* report */,
4DF760AF22A47C74004B0EF1 /* Importer.swift */,
4D0F103822C4C1C4005F797A /* ChipCountParser.swift */,
4DF760C822A56497004B0EF1 /* Seed.swift */,
4DF7614C22A6CC0D004B0EF1 /* NotablePlayers.swift */,
4DF760C022A561A8004B0EF1 /* UI */,
@ -310,15 +317,9 @@
4DF760B622A47F72004B0EF1 /* Events */ = {
isa = PBXGroup;
children = (
4D0F103422C4C04F005F797A /* chipcount */,
4DF760C422A56451004B0EF1 /* event1 */,
4DF760B422A47F6D004B0EF1 /* event2 */,
4DF760D122A56793004B0EF1 /* event55 */,
4DF7610522A56797004B0EF1 /* event52 */,
4DF760F422A56795004B0EF1 /* event53 */,
4DF760EC22A56795004B0EF1 /* event54 */,
4DF7610122A56796004B0EF1 /* event56 */,
4DF760CF22A56793004B0EF1 /* event2 copie 13 */,
4DF760D222A56793004B0EF1 /* event2 copie 14 */,
4DF760D322A56793004B0EF1 /* event2 copie 15 */,
4DF760B722A5234D004B0EF1 /* event3 */,
4DF7610622A56797004B0EF1 /* event3 copie 5 */,
@ -376,7 +377,14 @@
4DF760E122A56794004B0EF1 /* event47 */,
4DF760DC22A56794004B0EF1 /* event48 */,
4DF760F622A56796004B0EF1 /* event49 */,
4DF760CF22A56793004B0EF1 /* event50 */,
4DF760E222A56794004B0EF1 /* event51 */,
4DF7610522A56797004B0EF1 /* event52 */,
4DF760F422A56795004B0EF1 /* event53 */,
4DF760EC22A56795004B0EF1 /* event54 */,
4DF760D122A56793004B0EF1 /* event55 */,
4DF7610122A56796004B0EF1 /* event56 */,
4DF760D222A56793004B0EF1 /* event57 */,
);
path = Events;
sourceTree = "<group>";
@ -419,6 +427,7 @@
4DA5CA1D22AD078A00AC628E /* CountryCounter.swift */,
4DDEF11322AE4FB900F4D7C1 /* TournamentStats.swift */,
4D18861022C36D8F0020C4CD /* TournamentCounter.swift */,
4D0F103622C4C08F005F797A /* ChipCount.swift */,
);
path = structures;
sourceTree = "<group>";
@ -532,7 +541,7 @@
4DF7610C22A56797004B0EF1 /* event7 in Resources */,
FFE9052C22BB7313006FEFA4 /* event34 in Resources */,
4DF7613122A56797004B0EF1 /* event20 in Resources */,
4DF7610E22A56797004B0EF1 /* event2 copie 14 in Resources */,
4DF7610E22A56797004B0EF1 /* event57 in Resources */,
4DF7611622A56797004B0EF1 /* event16 in Resources */,
4DF7611C22A56797004B0EF1 /* event3 copie 7 in Resources */,
4DF7611022A56797004B0EF1 /* event9 in Resources */,
@ -556,7 +565,8 @@
4DF7613922A56797004B0EF1 /* event35 in Resources */,
4DF7611522A56797004B0EF1 /* event30 in Resources */,
4DF7611422A56797004B0EF1 /* event10 in Resources */,
4DF7610B22A56797004B0EF1 /* event2 copie 13 in Resources */,
4D0F103522C4C04F005F797A /* chipcount in Resources */,
4DF7610B22A56797004B0EF1 /* event50 in Resources */,
4DF7612E22A56797004B0EF1 /* event12 in Resources */,
4DF7612222A56797004B0EF1 /* event38 in Resources */,
4DF7611122A56797004B0EF1 /* event3 copie 12 in Resources */,
@ -618,6 +628,7 @@
4DF760C222A561FF004B0EF1 /* CSVUtils.swift in Sources */,
4DF760B022A47C74004B0EF1 /* Importer.swift in Sources */,
4DF7614A22A66675004B0EF1 /* TournamentWinner.swift in Sources */,
4D0F103722C4C08F005F797A /* ChipCount.swift in Sources */,
4DF760B322A47CAE004B0EF1 /* Realm+Extensions.swift in Sources */,
4DF7608822A3FB96004B0EF1 /* DetailViewController.swift in Sources */,
4DF7615122A7AECA004B0EF1 /* TournamentRepresentable.swift in Sources */,
@ -627,6 +638,7 @@
4DF760A722A3FD12004B0EF1 /* Model.swift in Sources */,
4DF7614F22A6CF93004B0EF1 /* PlayerResult.swift in Sources */,
4DF7614622A59407004B0EF1 /* CumulatedResults.swift in Sources */,
4D0F103922C4C1C4005F797A /* ChipCountParser.swift in Sources */,
4DF760BF22A560AA004B0EF1 /* FileWriter.swift in Sources */,
4DA5CA1E22AD078A00AC628E /* CountryCounter.swift in Sources */,
4D18861122C36D8F0020C4CD /* TournamentCounter.swift in Sources */,

@ -11,5 +11,21 @@
continueAfterRunningActions = "No">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "TournamentStats/ChipCountParser.swift"
timestampString = "583321556.2358969"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "34"
endingLineNumber = "34"
landmarkName = "start()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

@ -83,20 +83,27 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="Arm-wq-HPj" style="IBUITableViewCellStyleDefault" id="WCw-Qf-5nD">
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="Arm-wq-HPj" detailTextLabel="HdP-BR-LBd" style="IBUITableViewCellStyleValue1" id="WCw-Qf-5nD">
<rect key="frame" x="0.0" y="28" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="WCw-Qf-5nD" id="37f-cq-3Eg">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Arm-wq-HPj">
<rect key="frame" x="16" y="0.0" width="288" height="43.5"/>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Arm-wq-HPj">
<rect key="frame" x="16" y="12" width="33.5" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="HdP-BR-LBd">
<rect key="frame" x="260" y="12" width="44" height="20.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>

@ -0,0 +1,95 @@
//
// ChipCountParser.swift
// TournamentStats
//
// Created by Laurent Morvillier on 27/06/2019.
// Copyright © 2019 Stax River. All rights reserved.
//
import Foundation
import RealmSwift
import Realm
enum ChipCountColumns : CaseIterable {
case rank
case player
case chipcount
case trend
case city
case state
}
class ChipCountParser {
static func start() -> ChipCountManager {
let realm = try! Realm()
var ccm = ChipCountManager(chipCounts: [], totalChips: 0.0)
try! realm.write {
let resourceName = "chipcount"
let path: String? = Bundle.main.path(forResource: resourceName, ofType: "")
if let path = path {
do {
let data = try String(contentsOfFile: path, encoding: .utf8)
ccm = ChipCountParser.parse(realm: realm, data: data)
} catch {
print(error)
}
} else {
print("could not find path for chipcount")
}
}
return ccm
}
static func parse(realm: Realm, data: String) -> ChipCountManager {
// cleanup raw data
let rawRows = data.split(separator: "\n")
var rows = rawRows.map { String($0) }
rows = rows.filter { !$0.isEmpty }
let columns = ChipCountColumns.allCases
let numberOfColumns = columns.count
let formatter = Formatter.importData
var playerName: String = ""
var totalChips: Double = 0.0
var ccs: [ChipCount] = []
for i in 0..<rows.count {
let row: String = rows[i]
let index = i % numberOfColumns
let currentColumn = columns[index]
switch currentColumn {
case .rank:
break
case .player:
playerName = row
case .chipcount:
let chips = formatter.number(from: row)?.doubleValue ?? 0.0
totalChips += chips
let cc = ChipCount(player: playerName, chips: chips)
ccs.append(cc)
case .trend:
break
case .city:
break
case .state:
break
}
}
return ChipCountManager(chipCounts: ccs, totalChips: totalChips)
}
}

@ -0,0 +1,79 @@
1
Phil Ivey
4,900,000
+200,000
-
-
2
Josh Arieh
3,750,000
+585,000
-
-
3
Bryce Yockey
2,485,000
-265,000
-
-
4
David Oppenheim
2,400,000
+200,000
-
-
5
Phillip Hui
1,880,000
+245,000
-
-
6
Shaun Deeb
1,730,000
+30,000
-
-
7
Dario Sammartino
1,400,000
-87,000
-
-
8
John Esposito
1,207,000
+157,000
-
-
9
Chris Vitch
1,100,000
+120,000
-
-
10
Talal Shakerchi
660,000
+140,000
-
-
11
Andrew Brown
510,000
-110,000
-
-
12
Dan Cates
441,000
+231,000
-
-
13
Chris Klodnicki
200,000
-380,000
-
-

@ -1,217 +0,0 @@
1
United StatesBrian Green
$345,669
1,084.8
Decatur
TX
United States
2
United StatesAli Imsirovic
$213,644
542.4
Vancouver
WA
United States
3
United StatesAsher Conniff
$145,097
488.2
Brooklyn
NY
United States
4
United StatesLoren Klein
$100,775
433.9
Verdi
NV
United States
5
United StatesPing Liu
$71,614
406.8
Chicago
IL
United States
6
CanadaDaniel Negreanu
$52,099
379.7
Toronto
ON
Canada
7
NetherlandsMartijn Gerrits
$38,823
325.4
-
-
Netherlands
8
United StatesZach Clark
$29,650
298.3
Las Vegas
NV
United States
9
United StatesCary Katz
$23,224
271.2
Las Vegas
NV
United States
10
United StatesAnatoly Filatov
$18,667
217.0
Blue Point
NY
United States
11
United StatesDarren Elias
$18,667
217.0
Philadelphia
PA
United States
12
United StatesDaniel Zack
$18,667
217.0
Princeton
NJ
United States
13
United StatesBen Lamb
$15,408
217.0
Henderson
NV
United States
14
United StatesBen Yu
$15,408
217.0
Las Vegas
NV
United States
15
FranceBenjamin Pollak
$15,408
108.5
Paris
-
France
16
United StatesNick Schulman
$13,070
108.5
New York
NY
United States
17
GermanyManig Loeser
$13,070
108.5
Bad Homburg
-
Germany
18
United StatesCraig Varnell
$13,070
108.5
Ft Collins
CO
United States
19
United StatesByron Kaverman
$11,402
108.5
Fort Jennings
OH
United States
20
PortugalManuel Afonso Soares Ruivo
$11,402
108.5
Coimbra
-
Portugal
21
United StatesDavid Benyamine
$11,402
54.2
Henderson
NV
United States
22
United StatesDan Shak
$11,402
54.2
Las Vegas
NV
United States
23
ChinaYong Wang
$11,402
54.2
-
-
China
24
United StatesArkadiy Tsinis
$11,402
54.2
Miami
FL
United States
25
United StatesErik Seidel
$11,402
54.2
Henderson
NV
United States
26
United KingdomToby Lewis
$11,402
54.2
Southampton
-
United Kingdom
27
United StatesMohsin Charania
$11,402
54.2
Chicago
IL
United States
28
United StatesBen Palmer
$10,238
54.2
Las Vegas
NV
United States
29
AustriaAndreas Eiler
$10,238
54.2
Scharding
-
Austria
30
United StatesThai Ha
$10,238
54.2
Factoryville
PA
United States
31
United KingdomMatas Cimbolas
$10,238
54.2
London
-
United Kingdom

@ -1,217 +0,0 @@
1
United StatesBrian Green
$345,669
1,084.8
Decatur
TX
United States
2
United StatesAli Imsirovic
$213,644
542.4
Vancouver
WA
United States
3
United StatesAsher Conniff
$145,097
488.2
Brooklyn
NY
United States
4
United StatesLoren Klein
$100,775
433.9
Verdi
NV
United States
5
United StatesPing Liu
$71,614
406.8
Chicago
IL
United States
6
CanadaDaniel Negreanu
$52,099
379.7
Toronto
ON
Canada
7
NetherlandsMartijn Gerrits
$38,823
325.4
-
-
Netherlands
8
United StatesZach Clark
$29,650
298.3
Las Vegas
NV
United States
9
United StatesCary Katz
$23,224
271.2
Las Vegas
NV
United States
10
United StatesAnatoly Filatov
$18,667
217.0
Blue Point
NY
United States
11
United StatesDarren Elias
$18,667
217.0
Philadelphia
PA
United States
12
United StatesDaniel Zack
$18,667
217.0
Princeton
NJ
United States
13
United StatesBen Lamb
$15,408
217.0
Henderson
NV
United States
14
United StatesBen Yu
$15,408
217.0
Las Vegas
NV
United States
15
FranceBenjamin Pollak
$15,408
108.5
Paris
-
France
16
United StatesNick Schulman
$13,070
108.5
New York
NY
United States
17
GermanyManig Loeser
$13,070
108.5
Bad Homburg
-
Germany
18
United StatesCraig Varnell
$13,070
108.5
Ft Collins
CO
United States
19
United StatesByron Kaverman
$11,402
108.5
Fort Jennings
OH
United States
20
PortugalManuel Afonso Soares Ruivo
$11,402
108.5
Coimbra
-
Portugal
21
United StatesDavid Benyamine
$11,402
54.2
Henderson
NV
United States
22
United StatesDan Shak
$11,402
54.2
Las Vegas
NV
United States
23
ChinaYong Wang
$11,402
54.2
-
-
China
24
United StatesArkadiy Tsinis
$11,402
54.2
Miami
FL
United States
25
United StatesErik Seidel
$11,402
54.2
Henderson
NV
United States
26
United KingdomToby Lewis
$11,402
54.2
Southampton
-
United Kingdom
27
United StatesMohsin Charania
$11,402
54.2
Chicago
IL
United States
28
United StatesBen Palmer
$10,238
54.2
Las Vegas
NV
United States
29
AustriaAndreas Eiler
$10,238
54.2
Scharding
-
Austria
30
United StatesThai Ha
$10,238
54.2
Factoryville
PA
United States
31
United KingdomMatas Cimbolas
$10,238
54.2
London
-
United Kingdom

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -22,7 +22,7 @@ struct TD {
class Seed {
static let tournamentsDescriptions = [
static let tournamentsDescriptions: [TD] = [
TD(date: "31/05/2019", name: "Casino Employees Event", number: 1, buyin: 500, entries: 685, prizePool: 297975),
TD(date: "30/05/2019", name: "Super Turbo Bounty", number: 2, buyin: 10000, entries: 204, prizePool: 1917600),
TD(date: "08/06/2019", name: "BIG 50 No-Limit Hold'em", number: 3, buyin: 500, entries: 28371, prizePool: 13509435),
@ -78,6 +78,9 @@ class Seed {
TD(date: "26/06/2019", name: "No-Limit Hold'em Deepstack 8-Handed", number: 53, buyin: 800, entries: 3759, prizePool: 2676408),
TD(date: "26/06/2019", name: "Razz", number: 54, buyin: 1500, entries: 363, prizePool: 490050),
TD(date: "26/06/2019", name: "No-Limit Hold'em Super Turbo Bounty", number: 56, buyin: 1500, entries: 1867, prizePool: 2520450),
TD(date: "27/06/2019", name: "Monster Stack No-Limit Hold'em", number: 50, buyin: 1500, entries: 6035, prizePool: 8147250),
TD(date: "27/06/2019", name: "Tag Team No-Limit Hold'em", number: 57, buyin: 1000, entries: 976, prizePool: 878400),
]
static func createTournaments() {

@ -11,16 +11,16 @@ import UIKit
class MasterViewController: UITableViewController {
var detailViewController: DetailViewController? = nil
var reports = [Any]()
var ccManager: ChipCountManager = ChipCountManager(chipCounts: [], totalChips: 0.0)
override func viewDidLoad() {
super.viewDidLoad()
self.ccManager = ChipCountParser.start()
// Do any additional setup after loading the view.
navigationItem.leftBarButtonItem = editButtonItem
let addButton = UIBarButtonItem(barButtonSystemItem: .play, target: self, action: #selector(generate(_:)))
navigationItem.rightBarButtonItem = addButton
if let split = splitViewController {
let controllers = split.viewControllers
detailViewController = (controllers[controllers.count-1] as! UINavigationController).topViewController as? DetailViewController
@ -39,25 +39,10 @@ class MasterViewController: UITableViewController {
}
@objc
func insertNewObject(_ sender: Any) {
reports.insert(NSDate(), at: 0)
let indexPath = IndexPath(row: 0, section: 0)
tableView.insertRows(at: [indexPath], with: .automatic)
}
// MARK: - Segues
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "showDetail" {
if let indexPath = tableView.indexPathForSelectedRow {
let object = reports[indexPath.row] as! NSDate
let controller = (segue.destination as! UINavigationController).topViewController as! DetailViewController
controller.detailItem = object
controller.navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem
controller.navigationItem.leftItemsSupplementBackButton = true
}
}
}
// MARK: - Table View
@ -67,31 +52,17 @@ class MasterViewController: UITableViewController {
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return reports.count
return self.ccManager.chipCounts.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
let object = reports[indexPath.row] as! NSDate
cell.textLabel!.text = object.description
let chipCount = self.ccManager.chipCounts[indexPath.row]
cell.textLabel!.text = chipCount.player
cell.detailTextLabel?.text = chipCount.percentage(totalChips: self.ccManager.totalChips)
return cell
}
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
reports.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .fade)
} else if editingStyle == .insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
}
}
}

@ -32,7 +32,7 @@ class Tournament : Object, Named {
var rows: [Columns] {
switch self.number {
case 1, 10, 32, 39, 47, 55, 53: return [.rank, .player, .earnings, .city, .state, .country]
case 1, 10, 32, 39, 47, 55, 53, 57: return [.rank, .player, .earnings, .city, .state, .country]
default: return Tournament.defaultColumns
}
}

@ -0,0 +1,28 @@
//
// ChipCount.swift
// TournamentStats
//
// Created by Laurent Morvillier on 27/06/2019.
// Copyright © 2019 Stax River. All rights reserved.
//
import Foundation
struct ChipCountManager {
var chipCounts: [ChipCount]
var totalChips: Double
}
struct ChipCount {
var player: String
var chips: Double
func percentage(totalChips: Double) -> String {
let percentage = self.chips / totalChips * 100
return "\(percentage)%"
}
}
Loading…
Cancel
Save