calcPoints in ritzenbergenlib.ts verschoben, Rangliste.vue verbessert, Tabelle.vue angepasst
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="js">
|
||||
import * as RitzenbergenLib from '../../ritzenbergenlib';
|
||||
import ritzenbergenlib from '../../ritzenbergenlib';
|
||||
import Modal from '../Modal.vue';
|
||||
|
||||
export default {
|
||||
@@ -38,7 +38,10 @@ export default {
|
||||
return results.find((result) => {
|
||||
return result.paarung.id === paarungsid;
|
||||
});
|
||||
}
|
||||
},
|
||||
calcPoints(tipp){
|
||||
return ritzenbergenlib.RitzenbergenLib.calcPoints(tipp);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -58,7 +61,7 @@ export default {
|
||||
<td>{{ result.paarung.heim }} - {{ result.paarung.gast }}</td>
|
||||
<td>{{ result.heim }} - {{ result.gast }}</td>
|
||||
<td>{{ tipps[i].tipp.heim }} - {{ tipps[i].tipp.gast }}</td>
|
||||
<td></td>
|
||||
<td>{{ calcPoints(tipps[i]) }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</Modal>
|
||||
|
||||
@@ -21,18 +21,9 @@ export default {
|
||||
this.spieltag=spieltag;
|
||||
this.user=user;
|
||||
},
|
||||
calcPoints(spiel){
|
||||
if(spiel.tipp==null) return 0;
|
||||
if(spiel.result==spiel.tipp) return 3;
|
||||
let differenztipp=spiel.tipp[0]-spiel.tipp[1];
|
||||
let differenz=spiel.result[0]-spiel.result[1];
|
||||
if(differenztipp==differenz) return 2;
|
||||
if(
|
||||
(spiel.tipp[0]>spiel.tipp[1] && spiel.result[0]>spiel.result[1]) ||
|
||||
(spiel.tipp[0]<spiel.tipp[1] && spiel.result[0]<spiel.result[1])
|
||||
) return 1;
|
||||
return 0;
|
||||
}
|
||||
calcPoints(spiel){
|
||||
return ritzenbergenlib.RitzenbergenLib.calcPoints(spiel);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Modal,
|
||||
|
||||
@@ -40,6 +40,19 @@ class RitzenbergenLib {
|
||||
if(path.startsWith("/")) return "http://192.168.188.38/Jonas/ritzenbergenapi"+path;
|
||||
else return "http://192.168.188.38/Jonas/ritzenbergenapi/"+path;
|
||||
}
|
||||
static calcPoints(spiel){ //TODO class dafür erstellen
|
||||
if(spiel.tipp==null) return 0;
|
||||
if(spiel.result==spiel.tipp) return 3;
|
||||
let differenztipp=spiel.tipp[0]-spiel.tipp[1];
|
||||
let differenz=spiel.result[0]-spiel.result[1];
|
||||
if(differenztipp==differenz) return 2;
|
||||
if(
|
||||
(spiel.tipp[0]>spiel.tipp[1] && spiel.result[0]>spiel.result[1]) ||
|
||||
(spiel.tipp[0]<spiel.tipp[1] && spiel.result[0]<spiel.result[1])
|
||||
) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Paarung {
|
||||
|
||||
Reference in New Issue
Block a user