diff --git a/TournamentStats.xcodeproj/project.pbxproj b/TournamentStats.xcodeproj/project.pbxproj index 3ade8be..f08fdf5 100644 --- a/TournamentStats.xcodeproj/project.pbxproj +++ b/TournamentStats.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ 4D26A94D23152316001C98D2 /* FestivalStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D26A94C23152316001C98D2 /* FestivalStats.swift */; }; 4D26A94F23152A1C001C98D2 /* StatCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4D26A94E23152A1C001C98D2 /* StatCollectionViewCell.xib */; }; 4D26A95123152A6B001C98D2 /* StatCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D26A95023152A6B001C98D2 /* StatCollectionViewCell.swift */; }; + 4D26A95423156F6F001C98D2 /* Game.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D26A95323156F6F001C98D2 /* Game.swift */; }; 4D2F1C4422CC92D1007C639E /* event81 in Resources */ = {isa = PBXBuildFile; fileRef = 4D2F1C2C22CC92CE007C639E /* event81 */; }; 4D2F1C4522CC92D1007C639E /* event80 in Resources */ = {isa = PBXBuildFile; fileRef = 4D2F1C2D22CC92CE007C639E /* event80 */; }; 4D2F1C4622CC92D1007C639E /* event76 in Resources */ = {isa = PBXBuildFile; fileRef = 4D2F1C2E22CC92CE007C639E /* event76 */; }; @@ -163,6 +164,7 @@ 4D26A94C23152316001C98D2 /* FestivalStats.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FestivalStats.swift; sourceTree = ""; }; 4D26A94E23152A1C001C98D2 /* StatCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = StatCollectionViewCell.xib; sourceTree = ""; }; 4D26A95023152A6B001C98D2 /* StatCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatCollectionViewCell.swift; sourceTree = ""; }; + 4D26A95323156F6F001C98D2 /* Game.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Game.swift; sourceTree = ""; }; 4D2F1C2C22CC92CE007C639E /* event81 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event81; sourceTree = ""; }; 4D2F1C2D22CC92CE007C639E /* event80 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event80; sourceTree = ""; }; 4D2F1C2E22CC92CE007C639E /* event76 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = event76; sourceTree = ""; }; @@ -526,6 +528,7 @@ children = ( 4DF760C122A561FF004B0EF1 /* ColumnRepresentable.swift */, 4DF760BE22A560AA004B0EF1 /* FileWriter.swift */, + 4D26A95323156F6F001C98D2 /* Game.swift */, ); path = utils; sourceTree = ""; @@ -798,6 +801,7 @@ 4D39B6F122F829A500625E31 /* InfographyViewController.swift in Sources */, 4DF760B322A47CAE004B0EF1 /* Realm+Extensions.swift in Sources */, 4DF7608822A3FB96004B0EF1 /* DetailViewController.swift in Sources */, + 4D26A95423156F6F001C98D2 /* Game.swift in Sources */, 4DF78DD122F9AADF00C02F73 /* TableView.swift in Sources */, 4D26A94D23152316001C98D2 /* FestivalStats.swift in Sources */, 4DF78DD622F9CE7E00C02F73 /* TitleLabel.swift in Sources */, diff --git a/TournamentStats/report/Queries.swift b/TournamentStats/report/Queries.swift index e0f974d..e81ac3c 100644 --- a/TournamentStats/report/Queries.swift +++ b/TournamentStats/report/Queries.swift @@ -278,13 +278,16 @@ class Queries { let tournaments: Results = realm.objects(Tournament.self) - let holdem = DistributionCounter(name: "Hold'em") - let not = DistributionCounter(name: "Not Hold'em") - let games: [DistributionCounter] = [holdem, not] + let holdem = DistributionCounter(name: Game.holdem.rawValue) + let omaha = DistributionCounter(name: Game.omaha.rawValue) + let not = DistributionCounter(name: "Others") + let games: [DistributionCounter] = [holdem, omaha, not] tournaments.forEach { tournament in - if tournament.name.contains("Hold'em") { + if tournament.name.contains(Game.holdem.rawValue) { holdem.increment() + } else if tournament.name.contains(Game.omaha.rawValue) { + omaha.increment() } else { not.increment() } diff --git a/TournamentStats/utils/Game.swift b/TournamentStats/utils/Game.swift new file mode 100644 index 0000000..0893dfb --- /dev/null +++ b/TournamentStats/utils/Game.swift @@ -0,0 +1,14 @@ +// +// File.swift +// TournamentStats +// +// Created by Laurent Morvillier on 27/08/2019. +// Copyright © 2019 Stax River. All rights reserved. +// + +import Foundation + +enum Game : String { + case holdem = "Hold'em" + case omaha = "Pot-Limit Omaha" +}