From 5227111dff3c2a71656d6086ae601fdcfd867bf5 Mon Sep 17 00:00:00 2001 From: Ken Eucker Date: Thu, 4 Jan 2024 23:19:04 -0800 Subject: [PATCH] fix(sanity): fixes bugs around achievements that were missed in previous commits --- examples/node/index.js | 14 +++++++------- src/common/data.ts | 2 +- src/sanity/helpers.ts | 3 ++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/examples/node/index.js b/examples/node/index.js index 7e4295b..0ef1b98 100644 --- a/examples/node/index.js +++ b/examples/node/index.js @@ -189,8 +189,8 @@ const runTests = async (out = false) => { await get10PlayersAsync("BikeTag", biketagDefaultInstance, out) } - // if (false) { - if (bikeTagImgurInstance) { + if (false) { + // if (bikeTagImgurInstance) { console.log(pretty("Imgur BikeTag Client Instantiated"), imgurInstanceOpts) await getGameAsync("Imgur", bikeTagImgurInstance, out) // await getTag1Async("Imgur", bikeTagImgurInstance, out) @@ -202,16 +202,16 @@ const runTests = async (out = false) => { // await get10PlayersAsync("Imgur", bikeTagImgurInstance, out) } - if (false) { - // if (bikeTagSanityInstance) { + // if (false) { + if (bikeTagSanityInstance) { console.log(pretty("Sanity BikeTag Client Instantiated"), sanityInstanceOpts) // await getTag1Async("Sanity", bikeTagSanityInstance, out) // await get10TagsAsync("Sanity", bikeTagSanityInstance, out) await getGameAsync("Sanity", bikeTagSanityInstance, out) // await getAllGamesAsync("Sanity", bikeTagSanityInstance, out) - await get10PlayersAsync("Sanity", bikeTagSanityInstance, out) - await get1PlayerAsync("Sanity", bikeTagSanityInstance, out) - // await get10AchievementsAsync("Sanity", bikeTagSanityInstance, out) + // await get10PlayersAsync("Sanity", bikeTagSanityInstance, out) + // await get1PlayerAsync("Sanity", bikeTagSanityInstance, out) + await get10AchievementsAsync("Sanity", bikeTagSanityInstance, out) // await get10AmbassadorsAsync("Sanity", bikeTagSanityInstance, out) // await get10SettingsAsync("Sanity", bikeTagSanityInstance, out) // await get10AchievementsAsync("Sanity", bikeTagSanityInstance, out) diff --git a/src/common/data.ts b/src/common/data.ts index 8fea7bf..67eccc4 100644 --- a/src/common/data.ts +++ b/src/common/data.ts @@ -168,7 +168,7 @@ export const createAchievementObject = ( name: achievementData.name ?? '', key: achievementData.key ?? '', value: achievementData.value ?? '', - group: achievementData.value ?? '', + group: achievementData.group ?? '', } as Achievement } export const achievementDataFields = Object.keys(createAchievementObject()) diff --git a/src/sanity/helpers.ts b/src/sanity/helpers.ts index eb9f32c..3fbb057 100644 --- a/src/sanity/helpers.ts +++ b/src/sanity/helpers.ts @@ -19,6 +19,7 @@ import { createAchievementObject, ambassadorDataReferenceFields, createAmbassadorObject, + achievementDataFields, settingDataFields, ambassadorDataFields, gameDataAssetFields, @@ -495,7 +496,7 @@ export function constructSanityFieldsQuery( case DataTypes.achievement: referenceFields = [] arrayFields = [] - fields = fields.length ? fields : settingDataFields + fields = fields.length ? fields : achievementDataFields break }