Fix resolution messages
This commit is contained in:
parent
f18d5825c2
commit
5f58eb7982
|
@ -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[]
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue
Block a user