OOP zu BuLi-Tipp hinzugefügt
This commit is contained in:
@@ -7,6 +7,7 @@ import Rangliste from "../components/bulitipp/Rangliste.vue";
|
||||
import Paarungsergebnisse from "../components/bulitipp/Paarungsergebnisse.vue";
|
||||
import Tabelle from "../components/bulitipp/Tabelle.vue";
|
||||
import RitzenbergenLib from "../ritzenbergenlib.ts";
|
||||
import SpieltagSumme from "../ritzenbergenlib.ts";
|
||||
import Loading from "../components/bulitipp/Loading.vue";
|
||||
|
||||
export default {
|
||||
@@ -23,46 +24,59 @@ export default {
|
||||
asyncComputed: {
|
||||
users: {
|
||||
get(){
|
||||
return fetch(RitzenbergenLib.api("/bulitipp/get-users.php"))
|
||||
return fetch(RitzenbergenLib.RitzenbergenLib.api("/bulitipp/get-users.php"))
|
||||
.then((response) => response.json())
|
||||
.then((result2) => {
|
||||
if(result2.reload) this.update();
|
||||
return result2.data;
|
||||
})
|
||||
.then((result) => {
|
||||
console.log(result);
|
||||
result.forEach((user, i) => {
|
||||
let sum = 0;
|
||||
this.spieltage.forEach((spieltag) => {
|
||||
this.ts.forEach((spieltag) => {
|
||||
console.log(spieltag);
|
||||
let points = spieltag.find((element) => {
|
||||
return element.user.id === user.id;
|
||||
});
|
||||
sum += points.points;
|
||||
sum += points.tsPoints;
|
||||
});
|
||||
user.points = sum;
|
||||
});
|
||||
return result;
|
||||
}).catch((error) => {
|
||||
})
|
||||
.then((result) => {
|
||||
return result.map(el => new RitzenbergenLib.User(el.name,el.kuerzel, el.points, el.id));
|
||||
})
|
||||
.catch((error) => {
|
||||
return null;
|
||||
});
|
||||
},
|
||||
default: [],
|
||||
watch: ["spieltage"]
|
||||
watch: ["ts"]
|
||||
},
|
||||
spieltage: {
|
||||
ts: {
|
||||
get() {
|
||||
return fetch(RitzenbergenLib.api("/bulitipp/ts.php"))
|
||||
return fetch(RitzenbergenLib.RitzenbergenLib.api("/bulitipp/ts.php"))
|
||||
.then((response) => response.json())
|
||||
.then((result2) => {
|
||||
if(result2.reload) this.update();
|
||||
return result2.data;
|
||||
});
|
||||
})
|
||||
.then((result)=>{
|
||||
result.map(element => element.map((element) => {
|
||||
|
||||
element.user=new RitzenbergenLib.User(element.user.name, element.user.kuerzel,0, element.user.id);
|
||||
return element;
|
||||
}));
|
||||
return result;
|
||||
})
|
||||
.then((result)=>result.map((el) => el.map((el)=> new RitzenbergenLib.SpieltagSumme(el.user,el.points))));
|
||||
},
|
||||
default: []
|
||||
},
|
||||
saison:{
|
||||
get(){
|
||||
return fetch(RitzenbergenLib.api("/bulitipp/saison.php"))
|
||||
return fetch(RitzenbergenLib.RitzenbergenLib.api("/bulitipp/saison.php"))
|
||||
.then((response) => response.text())
|
||||
.then((result)=> parseInt(result));
|
||||
},
|
||||
@@ -200,7 +214,7 @@ export default {
|
||||
];
|
||||
},
|
||||
loading(){
|
||||
return this.$asyncComputed.users.updating || this.$asyncComputed.spieltage.updating;
|
||||
return this.$asyncComputed.users.updating || this.$asyncComputed.ts.updating;
|
||||
},
|
||||
|
||||
},
|
||||
@@ -267,7 +281,7 @@ export default {
|
||||
<Paarungsergebnisse :paarungen="paarungen" :teams="teams" />
|
||||
|
||||
<!-- Punktetabelle -->
|
||||
<Tabelle :users="users" :spieltage="spieltage" />
|
||||
<Tabelle :users="users" :ts="ts" />
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
Reference in New Issue
Block a user