diff --git a/Sources/App/Controllers/StatsController.swift b/Sources/App/Controllers/StatsController.swift index 36e440b..4009d44 100644 --- a/Sources/App/Controllers/StatsController.swift +++ b/Sources/App/Controllers/StatsController.swift @@ -155,6 +155,10 @@ struct StatsController: RouteCollection { let isColdWar = match.codGame == "bocw" let numberOfPlayers = self.numberOfPlayers(match: match) + if match.competitive == false { + return false + } + if isColdWar { if numberOfPlayers == 0 { return true diff --git a/Sources/App/Data/MapData.swift b/Sources/App/Data/MapData.swift index bf15568..3ec6913 100644 --- a/Sources/App/Data/MapData.swift +++ b/Sources/App/Data/MapData.swift @@ -55,12 +55,25 @@ class MapData { 41: Map(id: 41, name: "Collateral", imageName: "bocw_collateral"), 42: Map(id: 42, name: "Diesel", imageName: "bocw_diesel"), 43: Map(id: 43, name: "Miami Strike", imageName: "bocw_miamistrike"), + + 44: Map(id: 44, name: "Amsterdam", imageName: "bocw_amsterdam"), + 45: Map(id: 45, name: "Game Show", imageName: "bocw_gameshow"), + 46: Map(id: 46, name: "ICBM", imageName: "bocw_icbm"), + 47: Map(id: 47, name: "KGB", imageName: "bocw_kgb"), + 48: Map(id: 48, name: "Mansion", imageName: "bocw_mansion"), + 49: Map(id: 49, name: "U-Bahn", imageName: "bocw_ubahn"), + + 50: Map(id: 50, name: "Alpine", imageName: "bocw_alpine"), + 51: Map(id: 51, name: "Duga", imageName: "bocw_duga"), + 52: Map(id: 52, name: "Golova", imageName: "bocw_golova"), + 53: Map(id: 53, name: "Ruka", imageName: "bocw_ruka"), + 54: Map(id: 54, name: "Sanatorium", imageName: "bocw_sanatorium"), ] static let bocwMaps = { - return [1,3,8,7,4,2,29,31,5,6,30,0,34,38,39,40,41,42,43].compactMap { + return [1,3,8,7,4,2,29,31,5,6,30,0,34,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54].compactMap { return allMaps[$0]; } .sorted { (m1, m2) -> Bool in diff --git a/Sources/App/Migrations/AddCODGame2.swift b/Sources/App/Migrations/AddCODGame2.swift index 9e94c30..805dcef 100644 --- a/Sources/App/Migrations/AddCODGame2.swift +++ b/Sources/App/Migrations/AddCODGame2.swift @@ -18,14 +18,14 @@ import Fluent // } //} -struct AddCODGame2: Migration { - +struct AddCasual:Migration{ + + func prepare(on database: Database) -> EventLoopFuture { return database.schema("match") - .field("codGame",.string) - .field("notes",.string) - .field("players",.string) + .field("competitive",.bool) + .field("gameMode",.int) .update() } @@ -35,3 +35,21 @@ struct AddCODGame2: Migration { } } + +//struct AddCODGame2: Migration { +// +// +// func prepare(on database: Database) -> EventLoopFuture { +// return database.schema("match") +// .field("codGame",.string) +// .field("notes",.string) +// .field("players",.string) +// .update() +// +// } +// +// func revert(on database: Database) -> EventLoopFuture { +// return database.schema("match23es").delete() +// } +//} +// diff --git a/Sources/App/Models/Match.swift b/Sources/App/Models/Match.swift index ed8fe4d..6fa4026 100644 --- a/Sources/App/Models/Match.swift +++ b/Sources/App/Models/Match.swift @@ -40,9 +40,18 @@ final class Match: Model, Content { @Field(key: "numberOfFinalKillsRuined") var numberOfFinalKillsRuined: Int? + @Field(key: "competitive") + var competitive: Bool + + @Field(key: "gameMode") + var gameMode: Int + + + + init() { } - init(id: UUID? = nil, map:String?, win:Bool, date:Date, roundsWon:Int?, roundsLost:Int?, codGame:String?, notes:String?, players:String?, sweaty:Bool?, finalKillRuinedPlayerId:Int?, numberOfFinalKillsRuined:Int?) { + init(id: UUID? = nil, map:String?, win:Bool, date:Date, roundsWon:Int?, roundsLost:Int?, codGame:String?, notes:String?, players:String?, sweaty:Bool?, finalKillRuinedPlayerId:Int?, numberOfFinalKillsRuined:Int?,competitive:Bool, gameMode:Int) { self.id = id self.map = map self.win = win @@ -55,6 +64,8 @@ final class Match: Model, Content { self.sweaty = sweaty self.finalKillRuinedPlayerId = finalKillRuinedPlayerId self.numberOfFinalKillsRuined = numberOfFinalKillsRuined + self.competitive = competitive + self.gameMode = gameMode } @@ -75,6 +86,8 @@ final class Match: Model, Content { self.sweaty = newMatch.sweaty self.finalKillRuinedPlayerId = newMatch.finalKillRuinedPlayerId self.numberOfFinalKillsRuined = newMatch.numberOfFinalKillsRuined + self.competitive = newMatch.competitive + self.gameMode = newMatch.gameMode } diff --git a/Sources/App/configure.swift b/Sources/App/configure.swift index ffa966c..eccb6a3 100644 --- a/Sources/App/configure.swift +++ b/Sources/App/configure.swift @@ -25,7 +25,7 @@ public func configure(_ app: Application) throws { ), as: .psql) //app.migrations.add(CreateMatch()) - app.migrations.add(AddCODGame2()) + app.migrations.add(AddCasual())