corretta update priorty
This commit is contained in:
parent
aab5210954
commit
f5d244a9a1
3 changed files with 8 additions and 5 deletions
|
@ -4,10 +4,12 @@ export const surfer = {
|
||||||
id: 0,
|
id: 0,
|
||||||
color: 'lightgray',
|
color: 'lightgray',
|
||||||
priority: '',
|
priority: '',
|
||||||
name: ''
|
name: '',
|
||||||
|
scores: [],
|
||||||
|
totalScore: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createPriority() {
|
export function createPriority(count = 4) {
|
||||||
const priority = {
|
const priority = {
|
||||||
surfers: [],
|
surfers: [],
|
||||||
round: {
|
round: {
|
||||||
|
@ -15,7 +17,7 @@ export function createPriority() {
|
||||||
heat: 1,
|
heat: 1,
|
||||||
category: ''
|
category: ''
|
||||||
},
|
},
|
||||||
surfersCount: 4
|
surfersCount: count
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let i = 0; i < priority.surfersCount; i++) {
|
for (let i = 0; i < priority.surfersCount; i++) {
|
||||||
|
|
|
@ -120,6 +120,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="text">{priority.surfers[id].name}</div>
|
<div class="text">{priority.surfers[id].name}</div>
|
||||||
|
<div class="text">{priority.surfers[id].totalScore}</div>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -79,14 +79,14 @@
|
||||||
function AddSurfer() {
|
function AddSurfer() {
|
||||||
if (priority.surfersCount < 6) {
|
if (priority.surfersCount < 6) {
|
||||||
priority.surfersCount += 1;
|
priority.surfersCount += 1;
|
||||||
priority.surfers.push(surfer);
|
priority = createPriority(priority.surfersCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function RemSurfer() {
|
function RemSurfer() {
|
||||||
if (priority.surfersCount > 2) {
|
if (priority.surfersCount > 2) {
|
||||||
priority.surfersCount -= 1;
|
priority.surfersCount -= 1;
|
||||||
priority.surfers.pop();
|
priority = createPriority(priority.surfersCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue