Only show most recent streak notif, relative econ imports, pubsub emulator
This commit is contained in:
parent
b7790a9678
commit
571d3e71b5
|
@ -14,7 +14,7 @@
|
||||||
"logs": "firebase functions:log",
|
"logs": "firebase functions:log",
|
||||||
"dev": "nodemon src/serve.ts",
|
"dev": "nodemon src/serve.ts",
|
||||||
"firestore": "firebase emulators:start --only firestore --import=./firestore_export",
|
"firestore": "firebase emulators:start --only firestore --import=./firestore_export",
|
||||||
"serve": "firebase use dev && yarn build && firebase emulators:start --only functions,firestore --import=./firestore_export",
|
"serve": "firebase use dev && yarn build && firebase emulators:start --only functions,firestore,pubsub --import=./firestore_export",
|
||||||
"db:update-local-from-remote": "yarn db:backup-remote && gsutil rsync -r gs://$npm_package_config_firestore/firestore_export ./firestore_export",
|
"db:update-local-from-remote": "yarn db:backup-remote && gsutil rsync -r gs://$npm_package_config_firestore/firestore_export ./firestore_export",
|
||||||
"db:backup-local": "firebase emulators:export --force ./firestore_export",
|
"db:backup-local": "firebase emulators:export --force ./firestore_export",
|
||||||
"db:rename-remote-backup-folder": "gsutil mv gs://$npm_package_config_firestore/firestore_export gs://$npm_package_config_firestore/firestore_export_$(date +%d-%m-%Y-%H-%M)",
|
"db:rename-remote-backup-folder": "gsutil mv gs://$npm_package_config_firestore/firestore_export gs://$npm_package_config_firestore/firestore_export_$(date +%d-%m-%Y-%H-%M)",
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { randomString } from '../../common/util/random'
|
||||||
import { chargeUser, getContract } from './utils'
|
import { chargeUser, getContract } from './utils'
|
||||||
import { APIError, newEndpoint, validate, zTimestamp } from './api'
|
import { APIError, newEndpoint, validate, zTimestamp } from './api'
|
||||||
|
|
||||||
import { FIXED_ANTE } from 'common/economy'
|
import { FIXED_ANTE } from '../../common/economy'
|
||||||
import {
|
import {
|
||||||
getCpmmInitialLiquidity,
|
getCpmmInitialLiquidity,
|
||||||
getFreeAnswerAnte,
|
getFreeAnswerAnte,
|
||||||
|
|
|
@ -27,7 +27,7 @@ import {
|
||||||
DEV_HOUSE_LIQUIDITY_PROVIDER_ID,
|
DEV_HOUSE_LIQUIDITY_PROVIDER_ID,
|
||||||
HOUSE_LIQUIDITY_PROVIDER_ID,
|
HOUSE_LIQUIDITY_PROVIDER_ID,
|
||||||
} from '../../common/antes'
|
} from '../../common/antes'
|
||||||
import { SUS_STARTING_BALANCE, STARTING_BALANCE } from 'common/economy'
|
import { SUS_STARTING_BALANCE, STARTING_BALANCE } from '../../common/economy'
|
||||||
|
|
||||||
const bodySchema = z.object({
|
const bodySchema = z.object({
|
||||||
deviceToken: z.string().optional(),
|
deviceToken: z.string().optional(),
|
||||||
|
|
|
@ -5,10 +5,10 @@ import { HOUSE_LIQUIDITY_PROVIDER_ID } from '../../common/antes'
|
||||||
import { createReferralNotification } from './create-notification'
|
import { createReferralNotification } from './create-notification'
|
||||||
import { ReferralTxn } from '../../common/txn'
|
import { ReferralTxn } from '../../common/txn'
|
||||||
import { Contract } from '../../common/contract'
|
import { Contract } from '../../common/contract'
|
||||||
import { LimitBet } from 'common/bet'
|
import { LimitBet } from '../../common/bet'
|
||||||
import { QuerySnapshot } from 'firebase-admin/firestore'
|
import { QuerySnapshot } from 'firebase-admin/firestore'
|
||||||
import { Group } from 'common/group'
|
import { Group } from '../../common/group'
|
||||||
import { REFERRAL_AMOUNT } from 'common/economy'
|
import { REFERRAL_AMOUNT } from '../../common/economy'
|
||||||
const firestore = admin.firestore()
|
const firestore = admin.firestore()
|
||||||
|
|
||||||
export const onUpdateUser = functions.firestore
|
export const onUpdateUser = functions.firestore
|
||||||
|
|
|
@ -271,9 +271,17 @@ function IncomeNotificationGroupItem(props: {
|
||||||
}
|
}
|
||||||
return newNotifications
|
return newNotifications
|
||||||
}
|
}
|
||||||
|
const combinedNotifs = combineNotificationsByAddingNumericSourceTexts(
|
||||||
const combinedNotifs =
|
notifications.filter((n) => n.sourceType !== 'betting_streak_bonus')
|
||||||
combineNotificationsByAddingNumericSourceTexts(notifications)
|
)
|
||||||
|
// Because the server's reset time will never align with the client's, we may
|
||||||
|
// erroneously sum 2 betting streak bonuses, therefore just show the most recent
|
||||||
|
const mostRecentBettingStreakBonus = notifications
|
||||||
|
.filter((n) => n.sourceType === 'betting_streak_bonus')
|
||||||
|
.sort((a, b) => a.createdTime - b.createdTime)
|
||||||
|
.pop()
|
||||||
|
if (mostRecentBettingStreakBonus)
|
||||||
|
combinedNotifs.unshift(mostRecentBettingStreakBonus)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
Loading…
Reference in New Issue
Block a user