From c811d695dfc8fcc7b4d528beffd3374e7447c17c Mon Sep 17 00:00:00 2001 From: James Chang Date: Thu, 8 Apr 2021 09:54:29 -0400 Subject: [PATCH] Resolve #13: Reduce MBLD score multiplier from 1E8 to 1E7 --- .../src/schema/models/personalBest/service.ts | 4 ++-- frontend/nuxt.config.js | 2 +- frontend/pages/public-pbs.vue | 17 +++++++++++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/backend/functions/src/schema/models/personalBest/service.ts b/backend/functions/src/schema/models/personalBest/service.ts index 7e770b0..63e2077 100644 --- a/backend/functions/src/schema/models/personalBest/service.ts +++ b/backend/functions/src/schema/models/personalBest/service.ts @@ -205,10 +205,10 @@ export class PersonalBestService extends PaginatedService { validatedArgs.movesCount = null; // rightmost 7 rights are for time (), lower is better - // remaining digits are for the score (x -1*1E8), higher is better + // remaining digits are for the score (x -1*1E7), higher is better score = validatedArgs.timeElapsed + - -100000000 * + -10000000 * ((validatedArgs.attemptsTotal - validatedArgs.attemptsSucceeded) * -1 + validatedArgs.attemptsSucceeded * 1); diff --git a/frontend/nuxt.config.js b/frontend/nuxt.config.js index 7d61a92..d88dae4 100644 --- a/frontend/nuxt.config.js +++ b/frontend/nuxt.config.js @@ -32,7 +32,7 @@ export default { }, { property: 'og:image', - content: 'https://cubepb.com/_nuxt/img/cubepb-logo-2.71bfc74.png', + content: 'https://cubepb.com/_nuxt/img/cubepb-logo-2-b.2c3896b.png', }, ], link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }], diff --git a/frontend/pages/public-pbs.vue b/frontend/pages/public-pbs.vue index 257a5ea..5368d53 100644 --- a/frontend/pages/public-pbs.vue +++ b/frontend/pages/public-pbs.vue @@ -11,7 +11,7 @@ v-for="(item, i) in events" :key="i" class="ma-2" - @click="applyPresetRoute(item)" + @click="applyEventPreset(item)" > @@ -141,22 +141,31 @@ export default { this.loadPresets() }, methods: { - applyPresetRoute(event) { + applyEventPreset(event) { // get the original sortBy/sortDesc const originalPageOptions = this.$route.query.pageOptions ? JSON.parse(atob(decodeURIComponent(this.$route.query.pageOptions))) : null + // replace event.id filters with new ones + const excludeFilterKeys = ['event.id'] + this.$router.push( generateRoute(this.$route.path, { ...originalPageOptions, - filters: [ + filters: (originalPageOptions.filters + ? originalPageOptions.filters.filter( + (filterObject) => + !excludeFilterKeys.includes(filterObject.field) + ) + : [] + ).concat([ { field: 'event.id', operator: 'eq', value: event.id, }, - ], + ]), }) ) },