prep for casual tracking
This commit is contained in:
@@ -155,6 +155,10 @@ struct StatsController: RouteCollection {
|
|||||||
let isColdWar = match.codGame == "bocw"
|
let isColdWar = match.codGame == "bocw"
|
||||||
let numberOfPlayers = self.numberOfPlayers(match: match)
|
let numberOfPlayers = self.numberOfPlayers(match: match)
|
||||||
|
|
||||||
|
if match.competitive == false {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
if isColdWar {
|
if isColdWar {
|
||||||
if numberOfPlayers == 0 {
|
if numberOfPlayers == 0 {
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -55,12 +55,25 @@ class MapData {
|
|||||||
41: Map(id: 41, name: "Collateral", imageName: "bocw_collateral"),
|
41: Map(id: 41, name: "Collateral", imageName: "bocw_collateral"),
|
||||||
42: Map(id: 42, name: "Diesel", imageName: "bocw_diesel"),
|
42: Map(id: 42, name: "Diesel", imageName: "bocw_diesel"),
|
||||||
43: Map(id: 43, name: "Miami Strike", imageName: "bocw_miamistrike"),
|
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 = {
|
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];
|
return allMaps[$0];
|
||||||
}
|
}
|
||||||
.sorted { (m1, m2) -> Bool in
|
.sorted { (m1, m2) -> Bool in
|
||||||
|
|||||||
@@ -18,14 +18,14 @@ import Fluent
|
|||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
struct AddCODGame2: Migration {
|
|
||||||
|
|
||||||
|
|
||||||
|
struct AddCasual:Migration{
|
||||||
|
|
||||||
|
|
||||||
func prepare(on database: Database) -> EventLoopFuture<Void> {
|
func prepare(on database: Database) -> EventLoopFuture<Void> {
|
||||||
return database.schema("match")
|
return database.schema("match")
|
||||||
.field("codGame",.string)
|
.field("competitive",.bool)
|
||||||
.field("notes",.string)
|
.field("gameMode",.int)
|
||||||
.field("players",.string)
|
|
||||||
.update()
|
.update()
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -35,3 +35,21 @@ struct AddCODGame2: Migration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//struct AddCODGame2: Migration {
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// func prepare(on database: Database) -> EventLoopFuture<Void> {
|
||||||
|
// return database.schema("match")
|
||||||
|
// .field("codGame",.string)
|
||||||
|
// .field("notes",.string)
|
||||||
|
// .field("players",.string)
|
||||||
|
// .update()
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// func revert(on database: Database) -> EventLoopFuture<Void> {
|
||||||
|
// return database.schema("match23es").delete()
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
|||||||
@@ -40,9 +40,18 @@ final class Match: Model, Content {
|
|||||||
@Field(key: "numberOfFinalKillsRuined")
|
@Field(key: "numberOfFinalKillsRuined")
|
||||||
var numberOfFinalKillsRuined: Int?
|
var numberOfFinalKillsRuined: Int?
|
||||||
|
|
||||||
|
@Field(key: "competitive")
|
||||||
|
var competitive: Bool
|
||||||
|
|
||||||
|
@Field(key: "gameMode")
|
||||||
|
var gameMode: Int
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
init() { }
|
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.id = id
|
||||||
self.map = map
|
self.map = map
|
||||||
self.win = win
|
self.win = win
|
||||||
@@ -55,6 +64,8 @@ final class Match: Model, Content {
|
|||||||
self.sweaty = sweaty
|
self.sweaty = sweaty
|
||||||
self.finalKillRuinedPlayerId = finalKillRuinedPlayerId
|
self.finalKillRuinedPlayerId = finalKillRuinedPlayerId
|
||||||
self.numberOfFinalKillsRuined = numberOfFinalKillsRuined
|
self.numberOfFinalKillsRuined = numberOfFinalKillsRuined
|
||||||
|
self.competitive = competitive
|
||||||
|
self.gameMode = gameMode
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,6 +86,8 @@ final class Match: Model, Content {
|
|||||||
self.sweaty = newMatch.sweaty
|
self.sweaty = newMatch.sweaty
|
||||||
self.finalKillRuinedPlayerId = newMatch.finalKillRuinedPlayerId
|
self.finalKillRuinedPlayerId = newMatch.finalKillRuinedPlayerId
|
||||||
self.numberOfFinalKillsRuined = newMatch.numberOfFinalKillsRuined
|
self.numberOfFinalKillsRuined = newMatch.numberOfFinalKillsRuined
|
||||||
|
self.competitive = newMatch.competitive
|
||||||
|
self.gameMode = newMatch.gameMode
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public func configure(_ app: Application) throws {
|
|||||||
), as: .psql)
|
), as: .psql)
|
||||||
|
|
||||||
//app.migrations.add(CreateMatch())
|
//app.migrations.add(CreateMatch())
|
||||||
app.migrations.add(AddCODGame2())
|
app.migrations.add(AddCasual())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user