diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt index 4c7186d..b8ae348 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt @@ -222,13 +222,14 @@ object OpenGotha { // TODO - table number is not any more kinda random like this ${(1..tournament.lastRound()).map { tournament.games(it) }.flatMapIndexed { index, games -> - games.values.mapIndexed { table, game -> - Triple(index + 1, table , game) + games.values.mapIndexedNotNull { table, game -> + if (game.black == 0 || game.white == 0) null + else Triple(index + 1, table , game) } }.joinToString("\n") { (round, table, game) -> """" + } + }.joinToString("\n") + } { $('#export').on('click', e => { let form = $('#tournament-infos')[0]; let shortName = form.val('shortName'); - let headers = headers(); - headers['Accept'] = 'application/xml'; + let hdrs = headers(); + hdrs['Accept'] = 'application/xml'; fetch(`${base}tour/${tour_id}`, { - headers: headers + headers: hdrs }).then(resp => { if (resp.ok) return resp.text() else throw "export error" }).then(txt => { - let blob = new Blob(['\uFEFF', txt], {type: 'application/xml;charset=utf-8'}); + let blob = new Blob(['\uFEFF', txt.trim()], {type: 'application/xml;charset=utf-8'}); downloadFile(blob, `${shortName}.xml`); }).catch(err => showError(err)); });