Fix pairgoth import and EGF/FFG export missing flush
This commit is contained in:
@@ -92,11 +92,13 @@ object StandingsHandler: PairgothApiHandler {
|
|||||||
val neededCriteria = ArrayList(tournament.pairing.placementParams.criteria)
|
val neededCriteria = ArrayList(tournament.pairing.placementParams.criteria)
|
||||||
if (!neededCriteria.contains(NBW)) neededCriteria.add(NBW)
|
if (!neededCriteria.contains(NBW)) neededCriteria.add(NBW)
|
||||||
exportToEGFFormat(tournament, sortedPairables, neededCriteria, writer)
|
exportToEGFFormat(tournament, sortedPairables, neededCriteria, writer)
|
||||||
|
writer.flush()
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
"application/ffg" -> {
|
"application/ffg" -> {
|
||||||
response.contentType = "text/plain;charset=${encoding}"
|
response.contentType = "text/plain;charset=${encoding}"
|
||||||
exportToFFGFormat(tournament, sortedPairables, writer)
|
exportToFFGFormat(tournament, sortedPairables, writer)
|
||||||
|
writer.flush()
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
else -> ApiHandler.badRequest("invalid Accept header: $accept")
|
else -> ApiHandler.badRequest("invalid Accept header: $accept")
|
||||||
|
@@ -27,7 +27,9 @@ class ImportServlet: HttpServlet() {
|
|||||||
if (json == null || !json.isObject) {
|
if (json == null || !json.isObject) {
|
||||||
resp.sendError(HttpServletResponse.SC_BAD_REQUEST)
|
resp.sendError(HttpServletResponse.SC_BAD_REQUEST)
|
||||||
} else {
|
} else {
|
||||||
apiResp = api.post("tour", json.asObject())
|
val filtered = Json.MutableObject(json.asObject())
|
||||||
|
filtered.remove("id")
|
||||||
|
apiResp = api.post("tour", filtered)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // xml ?
|
else { // xml ?
|
||||||
@@ -55,8 +57,10 @@ class ImportServlet: HttpServlet() {
|
|||||||
if (example == null || !example.isObject) {
|
if (example == null || !example.isObject) {
|
||||||
response.sendError(HttpServletResponse.SC_BAD_REQUEST)
|
response.sendError(HttpServletResponse.SC_BAD_REQUEST)
|
||||||
} else {
|
} else {
|
||||||
|
val filtered = Json.MutableObject(example.asObject())
|
||||||
|
filtered.remove("id")
|
||||||
val api = ApiTool().apply { setRequest(request) }
|
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) {
|
if (apiResp.isObject && apiResp.asObject().getBoolean("success") == true) {
|
||||||
response.contentType = "application/json; charset=UTF-8"
|
response.contentType = "application/json; charset=UTF-8"
|
||||||
response.writer.println(apiResp.toString())
|
response.writer.println(apiResp.toString())
|
||||||
|
@@ -78,7 +78,7 @@ Nbw NbV
|
|||||||
New Tournament Nouveau Tournoi
|
New Tournament Nouveau Tournoi
|
||||||
New tournament Nouveau tournoi
|
New tournament Nouveau tournoi
|
||||||
Next rounds seeding Méthode rondes suivantes
|
Next rounds seeding Méthode rondes suivantes
|
||||||
OpenGotha file Fichier OpenGotha
|
OpenGotha / Pairgoth file Fichier OpenGotha / Pairgoth
|
||||||
Pair Apparier
|
Pair Apparier
|
||||||
Pair-go tournament Tournoi de pair-go
|
Pair-go tournament Tournoi de pair-go
|
||||||
Pairing Appariements
|
Pairing Appariements
|
||||||
|
@@ -39,8 +39,8 @@
|
|||||||
<form id="import-form" class="ui form">
|
<form id="import-form" class="ui form">
|
||||||
<div class="popup-content">
|
<div class="popup-content">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>OpenGotha file</label>
|
<label>OpenGotha / Pairgoth file</label>
|
||||||
<input type="file" name="file" accept=".xml"/>
|
<input type="file" name="file" accept=".tour,.xml"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="popup-footer">
|
<div class="popup-footer">
|
||||||
|
Reference in New Issue
Block a user