Adrien Carteron 2 年之前
父節點
當前提交
7438efc359

+ 0 - 1
src/main/kotlin/re/chasam/Application.kt

@@ -14,7 +14,6 @@ fun main(args: Array<String>) {
 
 
 @Suppress("unused") // application.conf references the main function. This annotation prevents the IDE from marking it as unused.
 @Suppress("unused") // application.conf references the main function. This annotation prevents the IDE from marking it as unused.
 fun Application.module() {
 fun Application.module() {
-    val port = environment?.config?.propertyOrNull("database.port")?.getString()?.toInt()
     install(Koin) {
     install(Koin) {
         slf4jLogger()
         slf4jLogger()
         modules(tournamentModule)
         modules(tournamentModule)

+ 1 - 1
src/main/kotlin/re/chasam/models/impl/Player.kt

@@ -10,7 +10,7 @@ class Player (var name: String = "", var score: Int = 0, var rank : Int = 0) : C
         return this.score - other.score
         return this.score - other.score
     }
     }
     override fun toString(): String {
     override fun toString(): String {
-        return "$name $score"
+        return "$name $score $rank"
     }
     }
     override fun equals(other: Any?): Boolean {
     override fun equals(other: Any?): Boolean {
         if (other is Player)
         if (other is Player)

+ 0 - 1
src/main/kotlin/re/chasam/models/impl/TournamentImpl.kt

@@ -14,7 +14,6 @@ class TournamentImpl : Tournament, KoinComponent {
     override fun getPlayer(name: String) : Player? {
     override fun getPlayer(name: String) : Player? {
         val player = Player(name)
         val player = Player(name)
         val index = players.indexOf(player)
         val index = players.indexOf(player)
-        println("index: $index")
         if (index == -1)
         if (index == -1)
             return null
             return null
         return players[index]
         return players[index]

+ 1 - 1
src/main/kotlin/re/chasam/plugins/Routing.kt

@@ -7,7 +7,7 @@ import re.chasam.routes.*
 
 
 fun Application.configureRouting() {
 fun Application.configureRouting() {
     routing {
     routing {
-        usersRouting()
+        playersRouting()
         get("/") {
         get("/") {
             call.respondText("Hello World!")
             call.respondText("Hello World!")
         }
         }

+ 3 - 3
src/main/kotlin/re/chasam/routes/PlayersRoutes.kt

@@ -6,10 +6,10 @@ import io.ktor.server.request.*
 import io.ktor.server.response.*
 import io.ktor.server.response.*
 import io.ktor.server.routing.*
 import io.ktor.server.routing.*
 import org.koin.ktor.ext.inject
 import org.koin.ktor.ext.inject
-import re.chasam.models.TournamentImpl
-import re.chasam.models.Player
+import re.chasam.models.impl.TournamentImpl
+import re.chasam.models.impl.Player
 
 
-fun Route.usersRouting() {
+fun Route.playersRouting() {
 
 
     val tournamentImpl by inject<TournamentImpl>()
     val tournamentImpl by inject<TournamentImpl>()
     route("/players") {
     route("/players") {