Only show most recent streak notif, relative econ imports, pubsub emulator

This commit is contained in:
Ian Philips 2022-08-22 06:31:30 -06:00
parent b7790a9678
commit 571d3e71b5
5 changed files with 17 additions and 9 deletions

View File

@ -14,7 +14,7 @@
"logs": "firebase functions:log",
"dev": "nodemon src/serve.ts",
"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: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)",

View File

@ -18,7 +18,7 @@ import { randomString } from '../../common/util/random'
import { chargeUser, getContract } from './utils'
import { APIError, newEndpoint, validate, zTimestamp } from './api'
import { FIXED_ANTE } from 'common/economy'
import { FIXED_ANTE } from '../../common/economy'
import {
getCpmmInitialLiquidity,
getFreeAnswerAnte,

View File

@ -27,7 +27,7 @@ import {
DEV_HOUSE_LIQUIDITY_PROVIDER_ID,
HOUSE_LIQUIDITY_PROVIDER_ID,
} 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({
deviceToken: z.string().optional(),

View File

@ -5,10 +5,10 @@ import { HOUSE_LIQUIDITY_PROVIDER_ID } from '../../common/antes'
import { createReferralNotification } from './create-notification'
import { ReferralTxn } from '../../common/txn'
import { Contract } from '../../common/contract'
import { LimitBet } from 'common/bet'
import { LimitBet } from '../../common/bet'
import { QuerySnapshot } from 'firebase-admin/firestore'
import { Group } from 'common/group'
import { REFERRAL_AMOUNT } from 'common/economy'
import { Group } from '../../common/group'
import { REFERRAL_AMOUNT } from '../../common/economy'
const firestore = admin.firestore()
export const onUpdateUser = functions.firestore

View File

@ -271,9 +271,17 @@ function IncomeNotificationGroupItem(props: {
}
return newNotifications
}
const combinedNotifs =
combineNotificationsByAddingNumericSourceTexts(notifications)
const combinedNotifs = combineNotificationsByAddingNumericSourceTexts(
notifications.filter((n) => n.sourceType !== 'betting_streak_bonus')
)
// 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 (
<div