Use user ID instead of callsign to link to activator whenever possible.

This sends the user to the right activator page even in case of changed callsigns, club calls etc.
pull/10/head v1.10.1
Manuel Kasper 2020-10-25 18:25:11 +01:00
rodzic 3fbddecd37
commit 90694deae9
4 zmienionych plików z 12 dodań i 6 usunięć

Wyświetl plik

@ -6,7 +6,7 @@
{{ props.row.activationDate | formatActivationDate }} {{ props.row.activationDate | formatActivationDate }}
</b-table-column> </b-table-column>
<b-table-column field="ownCallsign" label="Activator" sortable> <b-table-column field="ownCallsign" label="Activator" sortable>
<router-link :to="makeActivatorLink(props.row.ownCallsign.toUpperCase())">{{ props.row.ownCallsign.toUpperCase() }}</router-link> <router-link :to="makeActivatorLinkUserId(props.row.userId)">{{ props.row.ownCallsign.toUpperCase() }}</router-link>
</b-table-column> </b-table-column>
<b-table-column field="qsos" label="QSOs" sortable numeric> <b-table-column field="qsos" label="QSOs" sortable numeric>
<span class="qsos" @click="openQsoList(props.row.id)">{{ props.row.qsos }}</span> <span class="qsos" @click="openQsoList(props.row.id)">{{ props.row.qsos }}</span>

Wyświetl plik

@ -153,6 +153,9 @@ export default {
}) })
return '/activators/' + longestPart return '/activators/' + longestPart
}, },
makeActivatorLinkUserId (userId) {
return '/activators/' + userId
},
makeSummitLink (summitCode) { makeSummitLink (summitCode) {
return '/summits/' + summitCode return '/summits/' + summitCode
}, },

Wyświetl plik

@ -1,7 +1,7 @@
<template> <template>
<PageLayout> <PageLayout>
<template v-slot:title>Activation</template> <template v-slot:title>Activation</template>
<template v-if="activationDetails" v-slot:subtitle><router-link :to="makeActivatorLink(activationDetails.OwnCallsign)">{{ activationDetails.OwnCallsign }}</router-link> on <router-link :to="makeSummitLink(summitCode)">{{ activationDetails.Summit }}</router-link>, <span class="activation-date">{{ niceActivationDate }}</span></template> <template v-if="activationDetails" v-slot:subtitle><router-link :to="makeActivatorLinkUserId(activationDetails.UserID)">{{ activationDetails.OwnCallsign }}</router-link> on <router-link :to="makeSummitLink(summitCode)">{{ activationDetails.Summit }}</router-link>, <span class="activation-date">{{ niceActivationDate }}</span></template>
<template> <template>
<section class="section"> <section class="section">

Wyświetl plik

@ -54,7 +54,7 @@
<div>Locator: <span class="locator">{{ locator }}</span></div> <div>Locator: <span class="locator">{{ locator }}</span></div>
<div v-if="$keycloak && $keycloak.authenticated && summit.coordinates">Distance/Bearing: <Bearing :latitude="summit.coordinates.latitude" :longitude="summit.coordinates.longitude" /></div> <div v-if="$keycloak && $keycloak.authenticated && summit.coordinates">Distance/Bearing: <Bearing :latitude="summit.coordinates.latitude" :longitude="summit.coordinates.longitude" /></div>
<div v-if="firstActivations">First activation: <div v-if="firstActivations">First activation:
<span v-for="(callsign, index) in firstActivations.callsigns" :key="callsign"><router-link :to="makeActivatorLink(callsign)"><strong>{{ callsign }}</strong></router-link>{{ index !== firstActivations.callsigns.length - 1 ? ' & ' : '' }}</span> <span v-for="(activator, index) in firstActivations.activators" :key="activator.userId"><router-link :to="makeActivatorLinkUserId(activator.userId)"><strong>{{ activator.callsign }}</strong></router-link>{{ index !== firstActivations.activators.length - 1 ? ' & ' : '' }}</span>
<span class="has-text-grey"> on {{ firstActivations.date | formatActivationDate }}</span></div> <span class="has-text-grey"> on {{ firstActivations.date | formatActivationDate }}</span></div>
<SummitAttributes :attributes="summit.attributes" /> <SummitAttributes :attributes="summit.attributes" />
@ -173,10 +173,13 @@ export default {
let firstActivationDate = this.activations[this.activations.length - 1].activationDate let firstActivationDate = this.activations[this.activations.length - 1].activationDate
let firstActivationCallsigns = [] let firstActivationCallsigns = []
for (let i = this.activations.length - 1; i >= 0 && this.activations[i].activationDate === firstActivationDate; i--) { for (let i = this.activations.length - 1; i >= 0 && this.activations[i].activationDate === firstActivationDate; i--) {
firstActivationCallsigns.push(this.activations[i].ownCallsign) firstActivationCallsigns.push({
callsign: this.activations[i].ownCallsign,
userId: this.activations[i].userId
})
} }
firstActivationCallsigns.sort() firstActivationCallsigns.sort((a, b) => (a.callsign > b.callsign) ? 1 : -1)
return { callsigns: firstActivationCallsigns, date: firstActivationDate } return { activators: firstActivationCallsigns, date: firstActivationDate }
}, },
region () { region () {
let regionCode = this.summitCode.substring(this.summitCode.indexOf('/') + 1, this.summitCode.indexOf('-')) let regionCode = this.summitCode.substring(this.summitCode.indexOf('/') + 1, this.summitCode.indexOf('-'))