Fix summons

clubs
Laurent 2 years ago
parent 6eb9791bf8
commit 1a9a61e171
  1. 1
      tournaments/models/tournament.py
  2. 31
      tournaments/templates/tournaments/broadcasted_summons.html

@ -64,6 +64,7 @@ class Tournament(models.Model):
weight = team_registration.weight() weight = team_registration.weight()
summon = TeamSummon(names, next_match.start_date, weight, stage, team_registration.logo) summon = TeamSummon(names, next_match.start_date, weight, stage, team_registration.logo)
summons.append(summon) summons.append(summon)
summons.sort(key=lambda s: s.weight)
return summons return summons

@ -16,7 +16,16 @@
fetch('/tournament/{{ tournament.id }}/summons/json/') fetch('/tournament/{{ tournament.id }}/summons/json/')
.then(res => res.json()) .then(res => res.json())
.then((data) => { .then((data) => {
this.paginatedMatches = this.paginate(this.paginate(data, 16), 8) this.paginatedMatches = this.paginate(data, 8)
const splitGroups = [];
this.paginatedMatches.forEach(group => {
const firstHalf = group.slice(0, group.length / 2);
const secondHalf = group.slice(group.length / 2);
splitGroups.push([firstHalf, secondHalf]);
});
this.paginatedMatches = splitGroups;
}) })
}, },
paginate(array, pageSize) { paginate(array, pageSize) {
@ -39,11 +48,12 @@
<div class="grid-x padding-bottom"> <div class="grid-x padding-bottom">
<template x-for="i in paginatedMatches.length" > <template x-for="i in paginatedMatches.length" >
<template x-for="column in paginatedMatches[i-1]" > <div x-show="active === i">
<div class="cell medium-6 large-6 topblock my-block"> <template x-for="column in paginatedMatches[i-1]" >
<div class="bubble"> <div class="cell medium-6 large-6 topblock my-block">
<template x-for="summon in column" > <div class="bubble">
<div class="table-row-4-colums bottom-border"> <template x-for="summon in column" >
<div class="table-row-4-colums bottom-border">
<div class="table-cell table-cell-large semibold"> <div class="table-cell table-cell-large semibold">
<template x-for="i in summon.names.length"> <template x-for="i in summon.names.length">
<span x-text="summon.names[i-1]"></span> <span x-text="summon.names[i-1]"></span>
@ -53,11 +63,12 @@
<div class="table-cell"><span x-text="summon.weight"></span></div> <div class="table-cell"><span x-text="summon.weight"></span></div>
<div class="table-cell large center"><span x-text="summon.date"></span></div> <div class="table-cell large center"><span x-text="summon.date"></span></div>
<div class="table-cell"><div class="mybox center"><span x-text="summon.stage"></span></div></div> <div class="table-cell"><div class="mybox center"><span x-text="summon.stage"></span></div></div>
</div> </div>
</template> </template>
</div>
</div> </div>
</div> </template>
</template> </div>
</template> </template>
</div> </div>
</div> </div>

Loading…
Cancel
Save