Skip to content

Commit

Permalink
Merge pull request #218 from KenEucker/develop
Browse files Browse the repository at this point in the history
v3.2.7
  • Loading branch information
KenEucker committed Jan 6, 2024
2 parents ce85e52 + 1148167 commit 7af7648
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 25 deletions.
1 change: 1 addition & 0 deletions functions/common/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,7 @@ export const setNewBikeTagPost = async (
/// Zero out the gps for the new location, as the GPS of a newly posted tag is the current/previous tag found location
newBikeTagPost.gps = { lat: 0, long: 0, alt: 0 }
/// Update the current BikeTag with the winning tag found information
previousBikeTag.gps = winningBikeTagPost.gps
previousBikeTag.foundImageUrl = winningBikeTagPost.foundImageUrl
previousBikeTag.foundTime = winningBikeTagPost.foundTime
previousBikeTag.foundLocation = winningBikeTagPost.foundLocation
Expand Down
2 changes: 1 addition & 1 deletion functions/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const profileHandler: Handler = async (event) => {
const success = dataIsArray ? data?.length : !!data
const profileFound = success ? (dataIsString ? JSON.parse(data) : data) : null

console.log({ profileFound })
// console.log({ profileFound })
if (profileFound) {
body = await getBikeTagPlayerProfile(profileFound, authorized, true)
} else {
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "biketag-vue",
"version": "3.2.6",
"version": "3.2.7",
"license": "AGPL-3.0-or-later",
"scripts": {
"lint": "npm run lint:js && npm run lint:style",
Expand All @@ -23,7 +23,7 @@
"@vueuse/head": "^0.7.5",
"ajv": "^8.10.0",
"autoprefixer": "^10.4.4",
"biketag": "^3.2.6",
"biketag": "^3.2.7",
"bootstrap": "^5.1.3",
"bootstrap-vue-next": "^0.15.5",
"crypto-js": "^4.1.1",
Expand Down
Binary file added public/images/biketag-ambassador.webp
Binary file not shown.
Binary file added public/images/biketag-player.webp
Binary file not shown.
53 changes: 40 additions & 13 deletions src/components/QueueFound.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@
<template #title> Location: {{ getLocation }} </template>
<p v-if="locationDisabled">{{ t('pages.round.image_first') }}</p>
<bike-tag-map
v-if="isGps"
variant="play/input"
:gps="gps"
:gps="isGps ? gps : getGame?.boundary?.lat ? getGame?.boundary : undefined"
:start="center"
@dragend="updateMarker"
/>
Expand All @@ -109,8 +108,16 @@
<b-modal
v-model="confirmInBoundary"
class="confirm-modal"
:title="t('pages.round.missing_gps_alert.title')"
:title="t('pages.round.location_oustide_boundary_alert.title')"
@ok="confirmedBoundary = true"
>
<p>{{ t('pages.round.location_oustide_boundary_alert.body') }}</p>
</b-modal>
<b-modal
v-model="confirmNoGPS"
class="confirm-modal"
:title="t('pages.round.missing_gps_alert.title')"
@ok="confirmedNoGPS = true"
>
<p>{{ t('pages.round.missing_gps_alert.body') }}</p>
</b-modal>
Expand Down Expand Up @@ -176,6 +183,8 @@ const toast = inject('toast')
const { t } = useI18n()
const boundary = ref({})
const isInBoundary = ref(false)
const confirmNoGPS = ref(false)
const confirmedNoGPS = ref(false)
const confirmInBoundary = ref(false)
const confirmedBoundary = ref(false)
let auth0 = isAuthenticationEnabled() ? useAuth0() : undefined
Expand Down Expand Up @@ -204,6 +213,9 @@ const hideModal = () => (showModal.value = false)
const onSubmit = async (e) => {
e.preventDefault()
uploadInProgress.value = true
const gpsIsDefault =
gps.value.lat === getGame.value?.boundary.lat && gps.value.lng === getGame.value?.boundary.lng
/// Attempts to fix the tagnumber === #NaN issue
if (!getCurrentBikeTag?.tagnumber) {
await store.setTags()
Expand All @@ -213,13 +225,18 @@ const onSubmit = async (e) => {
if (!location.value?.length) {
toast.open({
message: 'Please add your Found Location',
message: 'Please add a Found Location description',
type: 'error',
duration: 10000,
position: 'top',
})
uploadInProgress.value = false
return
} else if (confirmedNoGPS.value === false && gpsIsDefault) {
confirmNoGPS.value = true
confirmedNoGPS.value = true
uploadInProgress.value = false
return
}
if (calculateInBoundary()) {
Expand Down Expand Up @@ -295,7 +312,7 @@ const onSubmit = async (e) => {
return
}
if (location.value?.length == 0) {
if (gps.value.lat == null) {
if (!gps.value.lat) {
debug('location must be set')
uploadInProgress.value = false
return
Expand All @@ -319,11 +336,13 @@ const onSubmit = async (e) => {
foundLocation: location.value,
tagnumber: getCurrentBikeTag.value?.tagnumber ?? 0,
game: getGameName.value,
gps: {
lat: gps.value.lat,
long: gps.value.lng,
alt: gps.value.alt,
},
gps: !gpsIsDefault
? {
lat: gps.value.lat,
long: gps.value.lng,
alt: gps.value.alt,
}
: {},
inBoundary: isInBoundary.value,
}
uploadInProgress.value = false
Expand All @@ -344,6 +363,7 @@ const changeLocation = (e) => {
const setPlace = (e) => {
gps.value['lat'] = round(e.geometry.location.lat())
gps.value['lng'] = round(e.geometry.location.lng())
console.log('setPlace', { gps: gps.value })
center.value = { ...gps.value }
location.value = inputDOM.value.value.split(',')[0]
if (isGpsDefault.value) {
Expand All @@ -353,6 +373,7 @@ const setPlace = (e) => {
const updateMarker = (e) => {
gps.value['lat'] = round(e.latLng.lat())
gps.value['lng'] = round(e.latLng.lng())
if (isGpsDefault.value) {
isGpsDefault.value = false
}
Expand Down Expand Up @@ -421,11 +442,17 @@ const setImage = async (event) => {
lng: round(GPSData.longitude),
}
isGpsDefault.value = false
} else {
gps.value = getGame.value?.boundary
center.value = { ...gps.value }
} else if (getGame.value?.boundary.lat && getGame.value?.boundary.lng) {
gps.value = {
lat: getGame.value?.boundary.lat,
lng: getGame.value?.boundary.lng,
}
isGpsDefault.value = true
center.value = { ...gps.value }
} else {
isGpsDefault.value = false
}
center.value = { ...gps.value }
location.value = ''
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,13 @@
"reset_tag": "Reset tag submission",
"user_agree": "By uploading content to BikeTag, you agree to the terms of use set by the BikeTag Project",
"image_first": "Please upload your image first!",
"missing_gps_alert": {
"location_oustide_boundary_alert": {
"title": "Confirm location outside the limits",
"body": "The chosen location is outside the suggested game boundaries. Are you sure you want to continue?"
},
"missing_gps_alert": {
"title": "Confirm no GPS data?",
"body": "You have selected an image with no GPS data, and without moving the pin on the map we won't know where this tag is located. Please consider moving the pin on the map, or selecting a location from the autopopulated choices."
}
},
"howto": {
Expand Down
4 changes: 2 additions & 2 deletions src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const useStore = defineStore('store', {
async getRegionPolygon(region: any) {
try {
if (this.regionPolyon) return this.regionPolyon
else if (!region) {
else if (!region?.description?.length) {
return
}

Expand Down Expand Up @@ -297,7 +297,7 @@ export const useStore = defineStore('store', {
const names = this.leaderboard.map((p) => p.name)
return client.players({ names, cached }, gameOpts as any).then(async (d) => {
if (Array.isArray(d)) {
d.forEach(this.SET_PLAYER)
d.forEach((p) => this.SET_PLAYER(p))
}
})
},
Expand Down
1 change: 1 addition & 0 deletions src/views/Player.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ watch(
// mounted
onMounted(async () => {
await store.setPlayers() // ensure the players are set before fetching THIS player's additional profile info
store.fetchPlayerProfile(playerName.value)
})
</script>
Expand Down

0 comments on commit 7af7648

Please sign in to comment.