Compare commits

...

5 Commits
2.0.0 ... 3.0.1

Author SHA1 Message Date
TeamCity
1edb3bfd89 ci: bump version to v3.0.1 2025-11-22 20:38:51 +00:00
9738a04b7a fix(api): Fixed a bug where the game would reload on game start (#81)
Reviewed-on: #81
Co-authored-by: Janis <janis.e.20@gmx.de>
Co-committed-by: Janis <janis.e.20@gmx.de>
2025-11-22 21:36:23 +01:00
TeamCity
2bc50664e0 ci: bump version to v3.0.0 2025-11-20 15:31:03 +00:00
3e3a062a06 ci: bump version to v2.0.0 2025-11-20 16:27:39 +01:00
641c892981 fix(polling): Improve polling mechanism and delay handling (#60)
Reviewed-on: #60
2025-11-20 10:51:39 +01:00
9 changed files with 42 additions and 24 deletions

View File

@@ -111,3 +111,25 @@
* removed trailing ([c7dd72e](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/c7dd72ecc2786ef63daf2b4288093025a8e22bfd))
* removed trailing ([42a5adb](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/42a5adbae01802587a48a9de15bad44b5ef014cf))
## (2025-11-20)
### ⚠ BREAKING CHANGES
* **game:** Fixed polling, SPA, Gameplayloop etc. (#59)
### Features
* **ci:** Polling ([370de17](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/370de175db65edf87e7ab211190977b540a39d85))
* **ci:** Polling Added polling for when the game starts and a card gets played ([#58](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/issues/58)) ([e60fe7c](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/e60fe7c98dcab05949140a8a54ed6e4e2fbbc022))
* **game:** Fixed polling, SPA, Gameplayloop etc. ([#59](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/issues/59)) ([a58b2e0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/a58b2e03b11a54667d63ba6604f579a8e328c9d1))
* **ui:** added js routing, updated ingame ui, added tricktable ([#50](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/issues/50)) ([c220e54](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/c220e54bb8d87f4f0f37a089bcd993e8df806123)), closes [#43](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/issues/43) [#43](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/issues/43)
* **ui:** implement tie & trump menu, fixed some critical bugs ([#52](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/issues/52)) ([5d245d0](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/5d245d0011a5fb03193514303b45702cd8329224))
### Bug Fixes
* **polling:** Improve polling mechanism and delay handling ([#60](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/issues/60)) ([641c892](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/641c892981649eb85640527cc0fe325ff683fa77))
## (2025-11-22)
### Bug Fixes
* **api:** Fixed a bug where the game would reload on game start ([#81](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/issues/81)) ([9738a04](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/9738a04b7a3c63c8cd1450e563ec04823fb3c35a))

View File

@@ -2,11 +2,12 @@ package components
import de.knockoutwhist.components.DefaultConfiguration
import de.knockoutwhist.ui.UI
import de.knockoutwhist.utils.DelayHandler
import de.knockoutwhist.utils.events.EventListener
class WebApplicationConfiguration extends DefaultConfiguration {
override def uis: Set[UI] = Set()
override def listener: Set[EventListener] = Set()
override def listener: Set[EventListener] = Set(DelayHandler)
}

View File

@@ -59,7 +59,6 @@ class IngameController @Inject() (
case Some(g) =>
val results = Try {
returnInnerHTML(g, request.user)
}
if (results.isSuccess) {
Ok(views.html.main("In-Game - Knockout Whist")(results.get))
@@ -67,7 +66,7 @@ class IngameController @Inject() (
InternalServerError(results.failed.get.getMessage)
}
case None =>
NotFound("Game not found")
Redirect(routes.MainMenuController.mainMenu())
}
}
def startGame(gameId: String): Action[AnyContent] = authAction { implicit request: AuthenticatedRequest[AnyContent] =>
@@ -83,7 +82,8 @@ class IngameController @Inject() (
if (result.isSuccess) {
Ok(Json.obj(
"status" -> "success",
"redirectUrl" -> routes.IngameController.game(gameId).url
"redirectUrl" -> routes.IngameController.game(gameId).url,
"content" -> returnInnerHTML(game.get, request.user).toString()
))
} else {
val throwable = result.failed.get

View File

@@ -78,7 +78,8 @@ class PollingController @Inject() (
"name" -> u.name,
"id" -> u.id,
"self" -> (u.id == userSession.id)
))
)),
"maxPlayers" -> game.maxPlayers
)
}

View File

@@ -119,15 +119,6 @@ class GameLobby private(
}
}
}
waitingPromises.keys.foreach { playerId =>
val queue = eventsPerPlayer(playerId)
if (queue.nonEmpty) {
val promise = waitingPromises(playerId)
promise.success(queue.dequeue())
waitingPromises.remove(playerId)
}
}
}
/**

View File

@@ -14,7 +14,7 @@
</div>
<div class="row">
<div class="col">
<div class="p-3 text-center fs-4">Playeramount: @gamelobby.getPlayers.size / @gamelobby.maxPlayers</div>
<div class="p-3 text-center fs-4" id="playerAmount">Playeramount: @gamelobby.getPlayers.size / @gamelobby.maxPlayers</div>
</div>
</div>
<div class="row justify-content-center align-items-center flex-grow-1">

View File

@@ -79,7 +79,13 @@
})
})()
let polling = false;
function pollForUpdates(gameId) {
if (polling) {
console.log("[DEBUG] Polling already in progress. Skipping this cycle.");
return;
}
polling = true;
console.log(`[DEBUG] Starting poll cycle for Game ID: ${gameId} at ${new Date().toISOString()}`);
if (!gameId) {
console.error("[DEBUG] Game ID is missing. Stopping poll.");
@@ -90,7 +96,7 @@ function pollForUpdates(gameId) {
const $mainmenuElement = $('#main-menu-screen')
const $mainbody = $('#main-body')
if (!$handElement.length && !$lobbyElement.length && !$mainmenuElement.length && !$mainbody.length) {
setTimeout(() => pollForUpdates(gameId), 1000);
setTimeout(() => { polling = false; pollForUpdates(gameId) }, 1000);
return;
}
const route = jsRoutes.controllers.PollingController.polling(gameId);
@@ -254,6 +260,7 @@ function pollForUpdates(gameId) {
})
}
$("#players").html(newHtml);
$('#playerAmount').text(`Playeramount: ${data.users.length} / ${data.maxPlayers}`);
} else {
console.warn(`[DEBUG] Received unknown status: ${data.status}`);
}
@@ -267,11 +274,7 @@ function pollForUpdates(gameId) {
}
}),
complete: (() => {
if (!window.location.href.includes("game")) {
console.log("[DEBUG] Page URL changed. Stopping poll restart.");
return;
}
setTimeout(() => pollForUpdates(gameId), 200);
setTimeout(() => { polling = false; pollForUpdates(gameId) }, 200);
})
})
}

View File

@@ -1,3 +1,3 @@
MAJOR=1
MAJOR=3
MINOR=0
PATCH=9
PATCH=1