2017-08-10 23:14:45 +02:00
|
|
|
<template>
|
|
|
|
<section>
|
2017-08-13 01:23:24 +02:00
|
|
|
<header class="results-header">
|
2019-04-13 19:46:15 +02:00
|
|
|
<h1>{{ $t('results.headline') }}</h1>
|
2017-08-13 01:23:24 +02:00
|
|
|
</header>
|
2017-08-10 23:47:40 +02:00
|
|
|
|
2017-08-29 21:20:54 +02:00
|
|
|
<div class="results-content">
|
2019-04-13 19:46:15 +02:00
|
|
|
<p>{{ $t('results.entry') }}</p>
|
|
|
|
<span>{{ $t('results.hint') }}</span>
|
2017-08-29 21:20:54 +02:00
|
|
|
</div>
|
|
|
|
|
2017-08-10 23:47:40 +02:00
|
|
|
<ul class="party-results">
|
2019-03-20 23:39:49 +01:00
|
|
|
<li v-for="party of parties" :key="party.token">
|
2020-08-22 16:40:12 +02:00
|
|
|
<router-link :to="{ path: getPartyPath(party.id) }">
|
2017-08-27 14:04:49 +02:00
|
|
|
<div class="result-party-info">
|
|
|
|
<div class="result-party-logo">
|
2020-08-22 16:40:12 +02:00
|
|
|
<span>{{ party.token }}</span>
|
2017-08-27 14:04:49 +02:00
|
|
|
</div>
|
2017-08-27 13:40:07 +02:00
|
|
|
|
2017-08-27 15:43:14 +02:00
|
|
|
<h2>{{ getScorePercentage(party.score) }}%</h2>
|
2017-08-27 14:04:49 +02:00
|
|
|
</div>
|
2017-08-27 13:40:07 +02:00
|
|
|
|
2017-08-27 14:04:49 +02:00
|
|
|
<feather-zoom-in class="results-see-more" />
|
2017-08-27 23:03:48 +02:00
|
|
|
|
2019-03-25 11:23:02 +01:00
|
|
|
<v-progress
|
2017-08-15 22:25:25 +02:00
|
|
|
class="result-percentage"
|
2017-08-27 17:01:10 +02:00
|
|
|
:value="party.score"
|
2020-06-14 20:52:30 +02:00
|
|
|
:max="totalMaxPoints"
|
2019-03-20 23:39:49 +01:00
|
|
|
/>
|
2017-08-15 22:25:25 +02:00
|
|
|
</router-link>
|
2019-05-03 17:55:07 +02:00
|
|
|
|
2020-06-27 10:53:13 +02:00
|
|
|
<div class="party-results-national">
|
2019-05-03 17:55:07 +02:00
|
|
|
<span>
|
2020-07-13 21:40:33 +02:00
|
|
|
{{ party.name }}
|
2019-05-03 17:55:07 +02:00
|
|
|
</span>
|
|
|
|
</div>
|
2017-08-10 23:47:40 +02:00
|
|
|
</li>
|
|
|
|
</ul>
|
2017-08-27 00:50:47 +02:00
|
|
|
|
2019-05-05 16:39:12 +02:00
|
|
|
<div v-if="!isEmbedded" class="results-ctrls">
|
2019-04-13 19:46:15 +02:00
|
|
|
<p>{{ $t('results.thanks') }}</p>
|
2019-03-20 23:39:49 +01:00
|
|
|
<router-link tag="a"
|
|
|
|
class="btn"
|
2019-04-13 19:46:15 +02:00
|
|
|
:to="{ path: `/${$i18n.locale}/` }"
|
2019-03-20 23:39:49 +01:00
|
|
|
>
|
2019-04-13 19:46:15 +02:00
|
|
|
{{ $t('results.indexBtn') }}
|
2017-08-27 13:40:07 +02:00
|
|
|
</router-link>
|
2017-08-27 00:50:47 +02:00
|
|
|
<router-link
|
|
|
|
tag="a"
|
2017-08-27 13:40:07 +02:00
|
|
|
class="btn btn-dark btn-small"
|
2019-04-13 19:46:15 +02:00
|
|
|
:to="{ path: startOverUrl }"
|
2019-03-20 23:39:49 +01:00
|
|
|
>
|
2019-04-13 19:46:15 +02:00
|
|
|
{{ $t('results.startoverBtn') }}
|
2017-08-27 13:40:07 +02:00
|
|
|
<feather-rotate-cw />
|
2017-08-27 00:50:47 +02:00
|
|
|
</router-link>
|
|
|
|
</div>
|
2017-08-10 23:14:45 +02:00
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-06-27 10:53:13 +02:00
|
|
|
import { getTranslatedUrl } from '@/i18n/helper'
|
2020-06-14 20:52:30 +02:00
|
|
|
import { getPartiesWithScores, getTotalMaxPoints } from '@/app/euromat/scoring'
|
2020-08-22 16:40:12 +02:00
|
|
|
import {
|
|
|
|
apolloPersonsForResultsQuery,
|
|
|
|
apolloPersonsForResultsUpdate
|
|
|
|
} from '@/app/euromat/graphqlQueries'
|
2017-08-10 23:47:40 +02:00
|
|
|
|
2017-08-10 23:14:45 +02:00
|
|
|
export default {
|
|
|
|
name: 'Results',
|
|
|
|
|
2017-08-13 01:23:24 +02:00
|
|
|
components: {
|
2019-03-25 11:23:02 +01:00
|
|
|
'feather-zoom-in': () =>
|
|
|
|
import('vue-feather-icons/icons/ZoomInIcon' /* webpackChunkName: "icons" */),
|
|
|
|
'feather-rotate-cw': () =>
|
2020-06-27 10:53:13 +02:00
|
|
|
import('vue-feather-icons/icons/RotateCwIcon' /* webpackChunkName: "icons" */)
|
2017-08-13 01:23:24 +02:00
|
|
|
},
|
|
|
|
|
2017-08-10 23:14:45 +02:00
|
|
|
data () {
|
|
|
|
return {
|
2017-08-13 23:11:48 +02:00
|
|
|
scoringGrid: [],
|
2020-06-27 10:53:13 +02:00
|
|
|
scores: [],
|
2020-06-14 20:52:30 +02:00
|
|
|
parties: [],
|
|
|
|
totalMaxPoints: 0
|
2017-08-10 23:47:40 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-08-15 22:59:50 +02:00
|
|
|
computed: {
|
2019-04-13 19:46:15 +02:00
|
|
|
startOverUrl () {
|
|
|
|
return getTranslatedUrl('theses')
|
2019-05-05 16:39:12 +02:00
|
|
|
},
|
|
|
|
isEmbedded () {
|
|
|
|
return (
|
|
|
|
this.$route.query.embedded &&
|
|
|
|
this.$route.query.embedded === 'iframe'
|
|
|
|
)
|
2017-08-15 22:59:50 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-05-10 18:16:37 +02:00
|
|
|
async created () {
|
2019-03-20 23:39:49 +01:00
|
|
|
let emphasized
|
|
|
|
let answers
|
|
|
|
|
|
|
|
if (this.$browser.supports('sessionStorage')) {
|
|
|
|
emphasized = JSON.parse(sessionStorage.getItem('euromat-emphasized'))
|
|
|
|
answers = JSON.parse(sessionStorage.getItem('euromat-answers'))
|
|
|
|
} else {
|
|
|
|
emphasized = JSON.parse(this.$root.$data.backupStorage.emphasized)
|
|
|
|
answers = JSON.parse(this.$root.$data.backupStorage.answers)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!emphasized) {
|
2020-06-27 10:53:13 +02:00
|
|
|
await this.$router.push({ path: getTranslatedUrl('theses') })
|
2019-03-20 23:39:49 +01:00
|
|
|
}
|
|
|
|
|
2020-08-22 16:40:12 +02:00
|
|
|
const apolloResponse = await this.$apollo.query({ query: apolloPersonsForResultsQuery })
|
|
|
|
const parties = apolloPersonsForResultsUpdate(apolloResponse.data)
|
2019-05-10 18:16:37 +02:00
|
|
|
|
2020-06-14 20:52:30 +02:00
|
|
|
const partiesWithScores = getPartiesWithScores(answers, emphasized, parties)
|
|
|
|
this.parties = partiesWithScores.map(party => ({
|
2020-08-22 16:40:12 +02:00
|
|
|
id: party.id,
|
2020-06-14 20:52:30 +02:00
|
|
|
token: party.token,
|
2020-07-13 21:40:33 +02:00
|
|
|
score: party.score,
|
|
|
|
name: party.name
|
2020-06-14 20:52:30 +02:00
|
|
|
}))
|
2019-03-20 23:39:49 +01:00
|
|
|
.sort((a, b) => a.score - b.score)
|
|
|
|
.reverse()
|
2020-06-14 20:52:30 +02:00
|
|
|
this.totalMaxPoints = getTotalMaxPoints(answers, emphasized)
|
2019-03-20 23:39:49 +01:00
|
|
|
},
|
|
|
|
|
2017-08-10 23:47:40 +02:00
|
|
|
methods: {
|
2020-08-22 16:40:12 +02:00
|
|
|
getPartyPath (partyId) {
|
|
|
|
return `${getTranslatedUrl('party')}/${partyId}`
|
2017-08-13 21:42:02 +02:00
|
|
|
},
|
|
|
|
getScorePercentage (score) {
|
2020-06-14 20:52:30 +02:00
|
|
|
return (score / this.totalMaxPoints * 100).toFixed(2)
|
2017-08-10 23:14:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2017-08-10 23:47:40 +02:00
|
|
|
<style lang="scss" scoped>
|
2019-03-20 23:19:13 +01:00
|
|
|
@import "~@/styles/animations";
|
|
|
|
@import "~@/styles/colors";
|
|
|
|
@import "~@/styles/layout";
|
2017-08-13 01:23:24 +02:00
|
|
|
|
2019-05-03 17:55:07 +02:00
|
|
|
$result-bar-length: 92%;
|
|
|
|
|
2017-08-27 00:50:47 +02:00
|
|
|
section {
|
|
|
|
width: 95%;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
|
2017-08-13 01:23:24 +02:00
|
|
|
.results-header {
|
2017-08-29 21:20:54 +02:00
|
|
|
margin-bottom: $base-gap;
|
2017-08-27 15:43:14 +02:00
|
|
|
|
|
|
|
h1 {
|
|
|
|
margin-bottom: $small-gap;
|
|
|
|
}
|
2017-08-13 01:23:24 +02:00
|
|
|
}
|
|
|
|
|
2017-08-29 21:20:54 +02:00
|
|
|
.results-content {
|
|
|
|
margin-bottom: $base-gap;
|
|
|
|
|
|
|
|
span {
|
|
|
|
margin-top: $small-gap;
|
|
|
|
color: $text-color-secondary;
|
|
|
|
font-size: $font-size-small;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-10 23:47:40 +02:00
|
|
|
.party-results {
|
|
|
|
list-style: none;
|
|
|
|
width: 100%;
|
2017-08-27 00:50:47 +02:00
|
|
|
counter-reset: result;
|
2017-08-10 23:47:40 +02:00
|
|
|
|
|
|
|
li {
|
|
|
|
display: flex;
|
2017-08-13 01:23:24 +02:00
|
|
|
flex-direction: column;
|
2017-08-27 00:50:47 +02:00
|
|
|
align-items: flex-end;
|
2017-08-13 01:23:24 +02:00
|
|
|
margin-bottom: $base-gap;
|
2017-08-27 00:50:47 +02:00
|
|
|
position: relative;
|
|
|
|
|
2017-08-27 13:40:07 +02:00
|
|
|
&:hover .results-see-more {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
|
2017-08-27 00:50:47 +02:00
|
|
|
&::before {
|
|
|
|
counter-increment: result;
|
|
|
|
content: counter(result) ".";
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
left: 0;
|
|
|
|
transform: translateY(-50%);
|
|
|
|
color: $text-color-secondary;
|
|
|
|
font-size: $font-size-xlarge;
|
|
|
|
font-weight: 600;
|
|
|
|
}
|
2017-08-27 14:04:49 +02:00
|
|
|
|
|
|
|
@media (max-width: 650px) {
|
|
|
|
&::before {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
2017-08-27 00:50:47 +02:00
|
|
|
}
|
|
|
|
|
2019-05-03 17:55:07 +02:00
|
|
|
a:not(.party-results-national-logo) {
|
2017-08-27 00:50:47 +02:00
|
|
|
height: 80px;
|
2019-05-03 17:55:07 +02:00
|
|
|
width: $result-bar-length;
|
2017-08-27 00:50:47 +02:00
|
|
|
position: relative;
|
|
|
|
display: flex;
|
2017-08-27 13:40:07 +02:00
|
|
|
justify-content: space-between;
|
2017-08-27 00:50:47 +02:00
|
|
|
align-items: center;
|
2017-08-27 14:04:49 +02:00
|
|
|
|
|
|
|
@media (max-width: 650px) {
|
|
|
|
width: 100%;
|
|
|
|
}
|
2017-08-27 00:50:47 +02:00
|
|
|
}
|
|
|
|
|
2017-08-27 13:40:07 +02:00
|
|
|
h2,
|
|
|
|
.results-see-more {
|
2017-08-27 00:50:47 +02:00
|
|
|
position: relative;
|
|
|
|
z-index: 1;
|
2017-08-27 13:40:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
h2 {
|
2017-08-27 00:50:47 +02:00
|
|
|
color: $text-color-base;
|
|
|
|
font-weight: 600;
|
2017-08-27 16:16:05 +02:00
|
|
|
text-shadow: $text-shadow;
|
2017-08-27 00:50:47 +02:00
|
|
|
|
|
|
|
span {
|
|
|
|
font-weight: 400;
|
|
|
|
}
|
2017-08-10 23:47:40 +02:00
|
|
|
}
|
2017-08-15 22:25:25 +02:00
|
|
|
|
2017-08-27 13:40:07 +02:00
|
|
|
.results-see-more {
|
|
|
|
stroke: $text-color-base;
|
2017-08-27 16:16:05 +02:00
|
|
|
filter: drop-shadow($text-shadow);
|
2017-08-27 13:40:07 +02:00
|
|
|
height: 32px;
|
|
|
|
width: 32px;
|
|
|
|
opacity: 0;
|
|
|
|
transition: opacity 150ms $easeOutBack;
|
2017-08-27 14:04:49 +02:00
|
|
|
margin-right: $base-gap;
|
2017-08-27 13:40:07 +02:00
|
|
|
}
|
|
|
|
|
2017-08-15 22:25:25 +02:00
|
|
|
.result-percentage {
|
2017-08-27 00:50:47 +02:00
|
|
|
height: 100%;
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
2017-08-15 22:25:25 +02:00
|
|
|
}
|
2017-08-10 23:47:40 +02:00
|
|
|
}
|
2017-08-27 00:50:47 +02:00
|
|
|
|
2019-05-03 17:55:07 +02:00
|
|
|
.party-results-national {
|
|
|
|
width: $result-bar-length;
|
|
|
|
display: flex;
|
|
|
|
justify-content: flex-start;
|
|
|
|
align-items: center;
|
|
|
|
padding-top: calc(#{$small-gap} / 2);
|
|
|
|
padding-left: $small-gap;
|
|
|
|
|
|
|
|
svg {
|
|
|
|
margin-right: calc(#{$small-gap} / 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
> span {
|
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.party-results-national-logo {
|
|
|
|
display: inline-block;
|
|
|
|
font-weight: 700;
|
|
|
|
margin-left: calc(#{$small-gap} / 2);
|
|
|
|
|
|
|
|
> div {
|
2019-05-10 17:46:31 +02:00
|
|
|
width: 70px;
|
2019-05-04 14:50:48 +02:00
|
|
|
height: auto;
|
|
|
|
display: inline-flex;
|
2019-05-03 17:55:07 +02:00
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
2019-05-10 17:46:31 +02:00
|
|
|
vertical-align: middle;
|
2019-05-03 17:55:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
img {
|
|
|
|
object-fit: contain;
|
|
|
|
width: 80%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 650px) {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-27 14:04:49 +02:00
|
|
|
.result-party-info {
|
|
|
|
display: flex;
|
|
|
|
height: calc(100% - 4px);
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
|
|
|
|
.result-party-logo {
|
|
|
|
margin-right: $small-gap;
|
|
|
|
position: relative;
|
|
|
|
z-index: 1;
|
|
|
|
background: $background-secondary;
|
|
|
|
border-radius: $border-radius;
|
|
|
|
width: 80px;
|
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
margin-left: 2px;
|
|
|
|
|
|
|
|
img {
|
|
|
|
object-fit: contain;
|
|
|
|
}
|
2019-04-26 11:22:32 +02:00
|
|
|
|
|
|
|
span {
|
|
|
|
color: $text-color-invert;
|
|
|
|
font-weight: 700;
|
|
|
|
}
|
2017-08-27 14:04:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-27 00:50:47 +02:00
|
|
|
.results-ctrls {
|
|
|
|
margin-top: $base-gap * 2;
|
|
|
|
border-top: 4px solid $transparent-white;
|
2017-08-27 15:43:14 +02:00
|
|
|
padding-top: $small-gap;
|
|
|
|
|
|
|
|
p {
|
|
|
|
margin-bottom: $small-gap;
|
|
|
|
}
|
2017-08-27 14:04:49 +02:00
|
|
|
|
|
|
|
a:first-of-type {
|
|
|
|
margin-right: $small-gap;
|
|
|
|
}
|
2017-08-27 00:50:47 +02:00
|
|
|
}
|
2019-05-10 17:33:56 +02:00
|
|
|
|
|
|
|
.results-affiliation {
|
|
|
|
background: $medium-blue;
|
|
|
|
width: 100%;
|
|
|
|
margin-top: $base-gap * 2;
|
|
|
|
padding: calc(#{$small-gap} / 2);
|
|
|
|
border-radius: calc(#{$border-radius} / 3);
|
|
|
|
|
|
|
|
@media (max-width: 650px) {
|
|
|
|
padding: 0;
|
|
|
|
margin-top: $base-gap * 2;
|
|
|
|
border-top: 4px solid $transparent-white;
|
|
|
|
padding-top: $small-gap;
|
|
|
|
border-radius: 0;
|
|
|
|
background: transparent;
|
|
|
|
}
|
|
|
|
|
|
|
|
a {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
img {
|
|
|
|
width: 100%;
|
|
|
|
height: auto;
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
}
|
2017-08-10 23:47:40 +02:00
|
|
|
</style>
|