From e4eff46750cda1a72e03d58d45a064c7b6ffb818 Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Thu, 7 Mar 2024 05:43:45 +0100 Subject: [PATCH] Fix pairgoth import and EGF/FFG export missing flush --- .../kotlin/org/jeudego/pairgoth/api/StandingsHandler.kt | 2 ++ .../main/kotlin/org/jeudego/pairgoth/web/ImportServlet.kt | 8 ++++++-- view-webapp/src/main/webapp/WEB-INF/translations/fr | 4 ++-- view-webapp/src/main/webapp/index.html | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/StandingsHandler.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/StandingsHandler.kt index dbb6c77..10463a5 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/StandingsHandler.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/StandingsHandler.kt @@ -92,11 +92,13 @@ object StandingsHandler: PairgothApiHandler { val neededCriteria = ArrayList(tournament.pairing.placementParams.criteria) if (!neededCriteria.contains(NBW)) neededCriteria.add(NBW) exportToEGFFormat(tournament, sortedPairables, neededCriteria, writer) + writer.flush() return null } "application/ffg" -> { response.contentType = "text/plain;charset=${encoding}" exportToFFGFormat(tournament, sortedPairables, writer) + writer.flush() return null } else -> ApiHandler.badRequest("invalid Accept header: $accept") diff --git a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ImportServlet.kt b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ImportServlet.kt index be27b47..95dcd74 100644 --- a/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ImportServlet.kt +++ b/view-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ImportServlet.kt @@ -27,7 +27,9 @@ class ImportServlet: HttpServlet() { if (json == null || !json.isObject) { resp.sendError(HttpServletResponse.SC_BAD_REQUEST) } else { - apiResp = api.post("tour", json.asObject()) + val filtered = Json.MutableObject(json.asObject()) + filtered.remove("id") + apiResp = api.post("tour", filtered) } } else { // xml ? @@ -55,8 +57,10 @@ class ImportServlet: HttpServlet() { if (example == null || !example.isObject) { response.sendError(HttpServletResponse.SC_BAD_REQUEST) } else { + val filtered = Json.MutableObject(example.asObject()) + filtered.remove("id") val api = ApiTool().apply { setRequest(request) } - val apiResp = api.post("tour", example) + val apiResp = api.post("tour", filtered) if (apiResp.isObject && apiResp.asObject().getBoolean("success") == true) { response.contentType = "application/json; charset=UTF-8" response.writer.println(apiResp.toString()) diff --git a/view-webapp/src/main/webapp/WEB-INF/translations/fr b/view-webapp/src/main/webapp/WEB-INF/translations/fr index 7a6e468..7b594db 100644 --- a/view-webapp/src/main/webapp/WEB-INF/translations/fr +++ b/view-webapp/src/main/webapp/WEB-INF/translations/fr @@ -31,7 +31,7 @@ Create Créer Crit Crit Ctr Pays Dates Dates -Delete Supprimer +Delete Supprimer Download Télécharger Download the standalone web interface module which suits your need, then follow Télécharger le module d’interface web qui correspond à vos besoins, puis suivez Edit Éditer @@ -78,7 +78,7 @@ Nbw NbV New Tournament Nouveau Tournoi New tournament Nouveau tournoi Next rounds seeding Méthode rondes suivantes -OpenGotha file Fichier OpenGotha +OpenGotha / Pairgoth file Fichier OpenGotha / Pairgoth Pair Apparier Pair-go tournament Tournoi de pair-go Pairing Appariements diff --git a/view-webapp/src/main/webapp/index.html b/view-webapp/src/main/webapp/index.html index 1c58a9c..03040e2 100644 --- a/view-webapp/src/main/webapp/index.html +++ b/view-webapp/src/main/webapp/index.html @@ -39,8 +39,8 @@