bug fixes for double in

main
Ugo Finnendahl 2 months ago
parent 6f06cfc428
commit a1a37631b3
  1. 11
      assets/js/views/xoi/main.js
  2. 28
      site/models/xoi.php

@ -54,7 +54,7 @@ const pregame = {
<div><span class="label">Player 1:</span><d-playerElem v-index="active" @click="selectPlayer(0)" :player="page.players[0]"></d-playerElem></div> <div><span class="label">Player 1:</span><d-playerElem v-index="active" @click="selectPlayer(0)" :player="page.players[0]"></d-playerElem></div>
<div><span class="label">Player 2:</span><d-playerElem v-index="active" @click="selectPlayer(1)" :player="page.players[1]"></d-playerElem></div> <div><span class="label">Player 2:</span><d-playerElem v-index="active" @click="selectPlayer(1)" :player="page.players[1]"></d-playerElem></div>
<div><span class="label">X01:</span><d-plainElem v-index="active" @click="selectX01()" :text="page.modus"></d-plainElem></div> <div><span class="label">X01:</span><d-plainElem v-index="active" @click="selectX01()" :text="page.modus"></d-plainElem></div>
<div><span class="label">Out:</span><d-plainElem v-index="active" @click="selectIn()" :text="page.in"></d-plainElem></div> <div><span class="label">In:</span><d-plainElem v-index="active" @click="selectIn()" :text="page.in"></d-plainElem></div>
<!-- <div><span class="label">Best of Sets:</span><d-inputElem v-index="active" v-model="page.sets"></d-inputElem></div> --> <!-- <div><span class="label">Best of Sets:</span><d-inputElem v-index="active" v-model="page.sets"></d-inputElem></div> -->
<div><span class="label">Best of Legs (per Set):</span><d-inputElem v-index="active" v-model="page.legs"></d-inputElem></div> <div><span class="label">Best of Legs (per Set):</span><d-inputElem v-index="active" v-model="page.legs"></d-inputElem></div>
<div><d-plainElem text="Start" v-index="active" @click="$emit('resolve', page)"></d-plainElem></div> <div><d-plainElem text="Start" v-index="active" @click="$emit('resolve', page)"></d-plainElem></div>
@ -127,8 +127,7 @@ const player = {
props: ['page', 'id', 'current_stat'], props: ['page', 'id', 'current_stat'],
setup(props) { setup(props) {
const addStats = (stat1, stat2) => { const addStats = (stat1, stat2) => {
console.log(stat1); let res = {
return {
average: [stat1.average[0]+stat2.average[0], stat1.average[1]+stat2.average[1]], average: [stat1.average[0]+stat2.average[0], stat1.average[1]+stat2.average[1]],
first9: [stat1.first9[0]+stat2.first9[0], stat1.first9[1]+stat2.first9[1]], first9: [stat1.first9[0]+stat2.first9[0], stat1.first9[1]+stat2.first9[1]],
"60+": stat1["60+"]+stat2["60+"], "60+": stat1["60+"]+stat2["60+"],
@ -138,6 +137,12 @@ const player = {
"checkouts": [stat1.checkouts[0]+stat2.checkouts[0], stat1.checkouts[1]+stat2.checkouts[1]], "checkouts": [stat1.checkouts[0]+stat2.checkouts[0], stat1.checkouts[1]+stat2.checkouts[1]],
"checkoutPoints": [...stat1.checkoutPoints, ...stat2.checkoutPoints] "checkoutPoints": [...stat1.checkoutPoints, ...stat2.checkoutPoints]
} }
if ("checkins" in stat1 && "checkins" in stat2){
res["checkins"] = [stat1.checkins[0]+stat2.checkins[0], stat1.checkins[1]+stat2.checkins[1]];
res["checkinPoints"] = [...stat1.checkinPoints, ...stat2.checkinPoints];
}
return res;
} }
const inspect = !!props.page.enddate; const inspect = !!props.page.enddate;
const tourStats = computed(() => { const tourStats = computed(() => {

@ -16,25 +16,27 @@ class XoiPage extends Page {
$sum["checkouts"][0] += $stat2["checkouts"][0]; $sum["checkouts"][0] += $stat2["checkouts"][0];
$sum["checkoutPoints"] = array_merge($sum["checkoutPoints"], $stat2["checkoutPoints"]); $sum["checkoutPoints"] = array_merge($sum["checkoutPoints"], $stat2["checkoutPoints"]);
$sum["checkouts"][1] += $stat2["checkouts"][1]; $sum["checkouts"][1] += $stat2["checkouts"][1];
$sum["checkins"][0] += $stat2["checkins"][0]; if (array_key_exists("checkins", $stat1) && array_key_exists("checkins", $stat2)){
$sum["checkinPoints"] = array_merge($sum["checkinPoints"], $stat2["checkinPoints"]); $sum["checkins"][0] += $stat2["checkins"][0];
$sum["checkins"][1] += $stat2["checkins"][1]; $sum["checkinPoints"] = array_merge($sum["checkinPoints"], $stat2["checkinPoints"]);
$sum["checkins"][1] += $stat2["checkins"][1];
}
$sum["180"] += $stat2["180"]; $sum["180"] += $stat2["180"];
$sum["140+"] += $stat2["140+"]; $sum["140+"] += $stat2["140+"];
$sum["100+"] += $stat2["100+"]; $sum["100+"] += $stat2["100+"];
$sum["60+"] += $stat2["60+"]; $sum["60+"] += $stat2["60+"];
return $sum; return $sum;
} }
//
// /** /**
// * @kql-allowed * @kql-allowed
// */ */
// public function tournamentStats() { public function tournamentStats() {
// if (count($this->playerUUIDs()) == 2){ if (count($this->playerUUIDs()) == 2){
// return [$this->parent()->getStats($this->playerUUIDs()[0]),$this->parent()->getStats($this->playerUUIDs()[1])]; return [$this->parent()->getStats($this->playerUUIDs()[0]),$this->parent()->getStats($this->playerUUIDs()[1])];
// } }
// return []; return [];
// } }
// //
// public function reorderPlayer($order){ // public function reorderPlayer($order){
// kirby()->impersonate('kirby'); // kirby()->impersonate('kirby');

Loading…
Cancel
Save