Fix resolution messages

This commit is contained in:
Ian Philips 2022-09-12 08:57:46 -06:00
parent f18d5825c2
commit 5f58eb7982
2 changed files with 7 additions and 7 deletions

View File

@ -65,12 +65,12 @@ export type PrivateUser = {
initialDeviceToken?: string initialDeviceToken?: string
initialIpAddress?: string initialIpAddress?: string
apiKey?: string apiKey?: string
/** @deprecated - use notificationSubscriptionTypes */
notificationPreferences?: notification_subscribe_types notificationPreferences?: notification_subscribe_types
notificationSubscriptionTypes: notification_subscription_types notificationSubscriptionTypes: notification_subscription_types
} }
export type notification_destination_types = 'email' | 'browser' export type notification_destination_types = 'email' | 'browser'
export type notification_subscription_types = { export type notification_subscription_types = {
// Watched Markets // Watched Markets
all_comments_on_watched_markets: notification_destination_types[] all_comments_on_watched_markets: notification_destination_types[]

View File

@ -165,20 +165,20 @@ export const resolvemarket = newEndpoint(opts, async (req, auth) => {
groupBy(bets, (bet) => bet.userId), groupBy(bets, (bet) => bet.userId),
(bets) => getContractBetMetrics(contract, bets).invested (bets) => getContractBetMetrics(contract, bets).invested
) )
let resolutionText = contract.resolution ?? contract.question let resolutionText = outcome ?? contract.question
if (contract.outcomeType === 'FREE_RESPONSE') { if (contract.outcomeType === 'FREE_RESPONSE') {
const answerText = contract.answers.find( const answerText = contract.answers.find(
(answer) => answer.id === contract.resolution (answer) => answer.id === outcome
)?.text )?.text
if (answerText) resolutionText = answerText if (answerText) resolutionText = answerText
} else if (contract.outcomeType === 'BINARY') { } else if (contract.outcomeType === 'BINARY') {
if (resolutionText === 'MKT' && contract.resolutionProbability) if (resolutionText === 'MKT' && probabilityInt)
resolutionText = `${contract.resolutionProbability}%` resolutionText = `${probabilityInt}%`
else if (resolutionText === 'MKT') resolutionText = 'PROB' else if (resolutionText === 'MKT') resolutionText = 'PROB'
} else if (contract.outcomeType === 'PSEUDO_NUMERIC') { } else if (contract.outcomeType === 'PSEUDO_NUMERIC') {
if (resolutionText === 'MKT' && contract.resolutionValue) if (resolutionText === 'MKT' && value) resolutionText = `${value}`
resolutionText = `${contract.resolutionValue}`
} }
console.log('resolutionText: ', resolutionText)
await createCommentOrAnswerOrUpdatedContractNotification( await createCommentOrAnswerOrUpdatedContractNotification(
contract.id, contract.id,
'contract', 'contract',