From 5f58eb79823a8e5bce4ea4d0b87fc6d5a93a2c35 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Mon, 12 Sep 2022 08:57:46 -0600 Subject: [PATCH] Fix resolution messages --- common/user.ts | 2 +- functions/src/resolve-market.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/user.ts b/common/user.ts index dbf41c72..37e6abb8 100644 --- a/common/user.ts +++ b/common/user.ts @@ -65,12 +65,12 @@ export type PrivateUser = { initialDeviceToken?: string initialIpAddress?: string apiKey?: string + /** @deprecated - use notificationSubscriptionTypes */ notificationPreferences?: notification_subscribe_types notificationSubscriptionTypes: notification_subscription_types } export type notification_destination_types = 'email' | 'browser' - export type notification_subscription_types = { // Watched Markets all_comments_on_watched_markets: notification_destination_types[] diff --git a/functions/src/resolve-market.ts b/functions/src/resolve-market.ts index 887024a8..821063f3 100644 --- a/functions/src/resolve-market.ts +++ b/functions/src/resolve-market.ts @@ -165,20 +165,20 @@ export const resolvemarket = newEndpoint(opts, async (req, auth) => { groupBy(bets, (bet) => bet.userId), (bets) => getContractBetMetrics(contract, bets).invested ) - let resolutionText = contract.resolution ?? contract.question + let resolutionText = outcome ?? contract.question if (contract.outcomeType === 'FREE_RESPONSE') { const answerText = contract.answers.find( - (answer) => answer.id === contract.resolution + (answer) => answer.id === outcome )?.text if (answerText) resolutionText = answerText } else if (contract.outcomeType === 'BINARY') { - if (resolutionText === 'MKT' && contract.resolutionProbability) - resolutionText = `${contract.resolutionProbability}%` + if (resolutionText === 'MKT' && probabilityInt) + resolutionText = `${probabilityInt}%` else if (resolutionText === 'MKT') resolutionText = 'PROB' } else if (contract.outcomeType === 'PSEUDO_NUMERIC') { - if (resolutionText === 'MKT' && contract.resolutionValue) - resolutionText = `${contract.resolutionValue}` + if (resolutionText === 'MKT' && value) resolutionText = `${value}` } + console.log('resolutionText: ', resolutionText) await createCommentOrAnswerOrUpdatedContractNotification( contract.id, 'contract',