diff --git a/src/main/scala/de/htwg/se/sudoku/SudokuModule.scala b/src/main/scala/de/htwg/se/sudoku/SudokuModule.scala index 2b33392..4d82ab2 100644 --- a/src/main/scala/de/htwg/se/sudoku/SudokuModule.scala +++ b/src/main/scala/de/htwg/se/sudoku/SudokuModule.scala @@ -52,7 +52,7 @@ class MongoDBModule extends AbstractModule with ScalaModule { val defaultSize: Int = 9 val defaultHostname: String = "localhost" - val defaultFilePort: Int = 27017 + val defaultMongoDBPort: Int = 27017 override def configure(): Unit = { bindConstant().annotatedWith(Names.named("DefaultSize")).to(defaultSize) @@ -64,7 +64,7 @@ class MongoDBModule extends AbstractModule with ScalaModule { bind[GridInterface].annotatedWithName("normal").toInstance(new Grid(9)) bindConstant().annotatedWith(Names.named("MongoDBHost")).to(defaultHostname) - bindConstant().annotatedWith(Names.named("MongoDBPort")).to(defaultFilePort) + bindConstant().annotatedWith(Names.named("MongoDBPort")).to(defaultMongoDBPort) bind[FileIOInterface].to[fileIoMongoDBImpl.FileIO] } diff --git a/src/main/scala/de/htwg/se/sudoku/model/fileIoComponent/fileIoMongoDBImpl/FileIO.scala b/src/main/scala/de/htwg/se/sudoku/model/fileIoComponent/fileIoMongoDBImpl/FileIO.scala index e601b71..cbd9173 100644 --- a/src/main/scala/de/htwg/se/sudoku/model/fileIoComponent/fileIoMongoDBImpl/FileIO.scala +++ b/src/main/scala/de/htwg/se/sudoku/model/fileIoComponent/fileIoMongoDBImpl/FileIO.scala @@ -21,13 +21,13 @@ class FileIO @Inject()(@Named("MongoDBHost") host: String, @Named("MongoDBPort") private val collection = db.getCollection("sudoku-in-scala-col") override def load: Try[Option[GridInterface]] = { - val resF = collection.find().projection(Projections.excludeId()).toFuture() - val res = Await.result(resF, Duration.Inf) + val resultFuture = collection.find().projection(Projections.excludeId()).toFuture() + val result = Await.result(resultFuture, Duration.Inf) var gridOption: Option[GridInterface] = None Try { - val json: JsValue = Json.parse(res.head.toJson()) + val json: JsValue = Json.parse(result.head.toJson()) val size = (json \ "grid" \ "size").get.toString.toInt val injector = Guice.createInjector(new SudokuModule) @@ -69,8 +69,8 @@ class FileIO @Inject()(@Named("MongoDBHost") host: String, @Named("MongoDBPort") Try { Await.result(collection.drop().toFuture(), Duration.Inf) val gameStateDoc = Document.apply(gridToJson(grid).toString()) - val resF = collection.insertOne(gameStateDoc).toFuture() - Await.result(resF, Duration.Inf) + val resultFuture = collection.insertOne(gameStateDoc).toFuture() + Await.result(resultFuture, Duration.Inf) } }