Skip to content

Commit

Permalink
Add LJ version with no boost button
Browse files Browse the repository at this point in the history
  • Loading branch information
swantzter committed Jan 30, 2024
1 parent 4a204a7 commit 3ba4789
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 14 deletions.
6 changes: 6 additions & 0 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -603,9 +603,15 @@ const models: Model[] = [
options: [
'Even',
'Form, Ent 30 / Mus 20 / Crea, Var 10',
'Ent 30 / Form 25 / Mus, Cre, Var 15',
'Form, Ent 25 / Mus 20 / Crea, Var 15',
'Form, Ent 25 / Mus, Crea, Var 17'
]
},
{
name: 'No Boost button',
prop: 'noBoost',
type: 'boolean'
}
]
},
Expand Down
59 changes: 45 additions & 14 deletions src/views/scoring/experiments/FiveScalePresentation.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
<template>
<main
v-if="step === 'marks'"
class="grid grid-cols-4 grid-rows-score-five"
class="grid grid-cols-3"
:class="{
'grid-rows-score-five': !scoresheet?.options?.noBoost,
'grid-rows-score-five-no-boost': !!scoresheet?.options?.noBoost
}"
>
<score-button
label="Breaks"
class="col-span-5 col-start-1 row-start-1"
:class="{
'col-span-5 col-start-1 row-start-1': !scoresheet?.options?.noBoost,
'row-span-2 col-start-2 row-start-2': !!scoresheet?.options?.noBoost,
}"
color="red"
:value="tally('exp-break')"
:disabled="!!scoresheet?.completedAt"
Expand Down Expand Up @@ -54,8 +61,9 @@
/>

<score-button
v-if="!scoresheet?.options?.noBoost"
label="Boost"
class="row-span-5 col-span-2 col-start-2 row-start-2"
class="row-span-5 col-start-2 row-start-2"
color="indigo"
:value="tally('exp-boost')"
:disabled="!!scoresheet?.completedAt"
Expand All @@ -64,43 +72,46 @@

<score-button
label="Musicality +"
class="row-start-2 col-start-4"
class="row-start-2 col-start-3"
:value="tally('exp-musicPlus')"
:disabled="!!scoresheet?.completedAt"
@click="addMark({ schema: 'exp-musicPlus' })"
/>
<score-button
label="Form +"
class="row-start-3 col-start-4"
class="row-start-3 col-start-3"
:value="tally('exp-formPlus')"
:disabled="!!scoresheet?.completedAt"
@click="addMark({ schema: 'exp-formPlus' })"
/>
<score-button
label="Creativity +"
class="row-start-4 col-start-4"
class="row-start-4 col-start-3"
:value="tally('exp-creaPlus')"
:disabled="!!scoresheet?.completedAt"
@click="addMark({ schema: 'exp-creaPlus' })"
/>
<score-button
label="Entertainment +"
class="row-start-5 col-start-4"
class="row-start-5 col-start-3"
:value="tally('exp-entPlus')"
:disabled="!!scoresheet?.completedAt"
@click="addMark({ schema: 'exp-entPlus' })"
/>
<score-button
label="Variety +"
class="row-start-6 col-start-4"
class="row-start-6 col-start-3"
:value="tally('exp-varietyPlus')"
:disabled="!!scoresheet?.completedAt"
@click="addMark({ schema: 'exp-varietyPlus' })"
/>

<score-button
label="Miss"
class="col-span-5 col-start-1 row-start-7"
:class="{
'col-span-5 col-start-1 row-start-7': !scoresheet?.options?.noBoost,
'row-span-2 col-start-2 row-start-5': !!scoresheet?.options?.noBoost,
}"
color="red"
:value="tally('miss')"
:disabled="!!scoresheet?.completedAt"
Expand All @@ -110,7 +121,11 @@

<main
v-else-if="step === 'adjust'"
class="grid grid-cols-4 grid-rows-score-five"
class="grid grid-cols-4"
:class="{
'grid-rows-score-five': !scoresheet?.options?.noBoost,
'grid-rows-score-five-no-boost': !!scoresheet?.options?.noBoost
}"
>
<score-button
color="none"
Expand Down Expand Up @@ -159,11 +174,15 @@
<div
v-for="component, idx of components"
:key="component"
class="col-span-2 col-start-2 flex content-center justify-center flex-wrap"
class="col-span-2 col-start-2 flex justify-between items-center"
:class="`row-start-${2 + idx}`"
>
<div>{{ componentScore(component).toFixed(1) }}</div>
<progress class="w-full" max="10" :value="componentScore(component)" />
<span>0</span>
<div class="flex content-center justify-center flex-wrap w-full m-2">
<div>{{ (componentScore(component) * weights[component] * 10).toFixed(1) }}</div>
<progress class="w-full" max="10" :value="componentScore(component)" />
</div>
<span>{{ weights[component] * 100 }}</span>
</div>

<score-button
Expand Down Expand Up @@ -272,6 +291,14 @@ const weights = computed((): Record<Component, number> => {
crea: 1 / 6,
variety: 1 / 6
}
} else if (scoresheet.value?.options?.w2 === 'Ent 30 / Form 25 / Mus, Cre, Var 15') {
return {
music: 0.15,
form: 0.25,
crea: 0.15,
ent: 0.3,
variety: 0.15
}
}
return {
Expand All @@ -297,12 +324,16 @@ const result = computed(() => {
sum += componentScores[key] * weights.value[key]
}
return Math.round(clamp(sum, 0, 10) * 100) / 100
return Math.round(clamp(sum, 0, 100) * 10)
})
</script>

<style scoped>
.grid-rows-score-five {
grid-template-rows: 9vh repeat(5, calc(73vh / 5)) 9vh;
}
.grid-rows-score-five-no-boost {
grid-template-rows: 9vh repeat(5, calc(82vh / 5));
}
</style>

0 comments on commit 3ba4789

Please sign in to comment.