Add missing fields ; add AGA rules
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package org.jeudego.pairgoth.model
|
package org.jeudego.pairgoth.model
|
||||||
|
|
||||||
enum class Rules {
|
enum class Rules {
|
||||||
|
AGA,
|
||||||
FRENCH,
|
FRENCH,
|
||||||
JAPANESE,
|
JAPANESE,
|
||||||
CHINESE
|
CHINESE
|
||||||
|
@@ -235,7 +235,7 @@ fun Tournament.Companion.fromJson(json: Json.Object, default: Tournament<*>? = n
|
|||||||
location = json.getString("location") ?: default?.location ?: badRequest("missing location"),
|
location = json.getString("location") ?: default?.location ?: badRequest("missing location"),
|
||||||
online = json.getBoolean("online") ?: default?.online ?: false,
|
online = json.getBoolean("online") ?: default?.online ?: false,
|
||||||
komi = json.getDouble("komi") ?: default?.komi ?: 7.5,
|
komi = json.getDouble("komi") ?: default?.komi ?: 7.5,
|
||||||
rules = json.getString("rules")?.let { Rules.valueOf(it) } ?: default?.rules ?: Rules.FRENCH,
|
rules = json.getString("rules")?.let { Rules.valueOf(it) } ?: default?.rules ?: if (json.getString("country")?.lowercase(Locale.ROOT) == "fr") Rules.FRENCH else Rules.AGA,
|
||||||
gobanSize = json.getInt("gobanSize") ?: default?.gobanSize ?: 19,
|
gobanSize = json.getInt("gobanSize") ?: default?.gobanSize ?: 19,
|
||||||
timeSystem = json.getObject("timeSystem")?.let { TimeSystem.fromJson(it) } ?: default?.timeSystem ?: badRequest("missing timeSystem"),
|
timeSystem = json.getObject("timeSystem")?.let { TimeSystem.fromJson(it) } ?: default?.timeSystem ?: badRequest("missing timeSystem"),
|
||||||
rounds = json.getInt("rounds") ?: default?.rounds ?: badRequest("missing rounds"),
|
rounds = json.getInt("rounds") ?: default?.rounds ?: badRequest("missing rounds"),
|
||||||
|
@@ -168,6 +168,9 @@ onLoad(() => {
|
|||||||
country: form.val('country'),
|
country: form.val('country'),
|
||||||
online: form.val('online'),
|
online: form.val('online'),
|
||||||
location: form.val('location'),
|
location: form.val('location'),
|
||||||
|
rules: form.val('rules'),
|
||||||
|
gobanSize: form.val('gobanSize'),
|
||||||
|
komi: form.val('komi'),
|
||||||
pairing: {
|
pairing: {
|
||||||
type: form.val('pairing'),
|
type: form.val('pairing'),
|
||||||
// mmFloor: form.val('mmFloor'),
|
// mmFloor: form.val('mmFloor'),
|
||||||
|
@@ -147,6 +147,7 @@
|
|||||||
<label>Rules</label>
|
<label>Rules</label>
|
||||||
<span class="info"></span>
|
<span class="info"></span>
|
||||||
<select name="rules">
|
<select name="rules">
|
||||||
|
<option value="AGA" #if($tour && $tour.rules == 'AGA') selected #end>AGA rules</option>
|
||||||
<option value="CHINESE" #if($tour && $tour.rules == 'CHINESE') selected #end>Chinese rules</option>
|
<option value="CHINESE" #if($tour && $tour.rules == 'CHINESE') selected #end>Chinese rules</option>
|
||||||
<option value="FRENCH" #if(!$tour || $tour.rules == 'FRENCH') selected #end>French rules</option>
|
<option value="FRENCH" #if(!$tour || $tour.rules == 'FRENCH') selected #end>French rules</option>
|
||||||
<option value="JAPANESE" #if($tour && $tour.rules == 'JAPANESE') selected #end>Japanese rules</option>
|
<option value="JAPANESE" #if($tour && $tour.rules == 'JAPANESE') selected #end>Japanese rules</option>
|
||||||
|
Reference in New Issue
Block a user