2017-08-10 23:14:45 +02:00
|
|
|
<template>
|
|
|
|
<section>
|
|
|
|
<router-link :to="{ path: '/' }">
|
|
|
|
Zurück
|
|
|
|
</router-link>
|
2017-08-10 23:47:40 +02:00
|
|
|
|
|
|
|
<ul class="party-results">
|
|
|
|
<li v-for="party in parties">
|
|
|
|
<span>{{ party.token }}</span>
|
|
|
|
<progress :value="getPartyMatch(party)" :max="thesesCount">
|
|
|
|
{{ getPartyMatch(party) }}
|
|
|
|
</progress>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2017-08-10 23:14:45 +02:00
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2017-08-10 23:47:40 +02:00
|
|
|
import { getParties, getParty, getThesesCount } from '@/utils/data'
|
|
|
|
|
2017-08-10 23:14:45 +02:00
|
|
|
export default {
|
|
|
|
name: 'Results',
|
|
|
|
|
|
|
|
data () {
|
|
|
|
return {
|
2017-08-10 23:47:40 +02:00
|
|
|
results: {},
|
|
|
|
thesesCount: getThesesCount(),
|
|
|
|
parties: getParties()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
getPartyMatch (party) {
|
|
|
|
const { positions } = getParty(party.token)
|
2017-08-12 21:28:33 +02:00
|
|
|
return this.results
|
|
|
|
.filter(answer =>
|
|
|
|
answer.option.position === positions[answer.thesis.id].position)
|
|
|
|
.length
|
2017-08-10 23:14:45 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted () {
|
|
|
|
this.results = JSON.parse(localStorage.getItem('results'))
|
2017-08-10 23:47:40 +02:00
|
|
|
console.log(this.results)
|
2017-08-10 23:14:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2017-08-10 23:47:40 +02:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
.party-results {
|
|
|
|
list-style: none;
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
li {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
progress {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|