diff --git a/functions/package.json b/functions/package.json index d6278c25..63ef9b5d 100644 --- a/functions/package.json +++ b/functions/package.json @@ -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)", diff --git a/functions/src/create-market.ts b/functions/src/create-market.ts index c3780a1f..ae120c43 100644 --- a/functions/src/create-market.ts +++ b/functions/src/create-market.ts @@ -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, diff --git a/functions/src/create-user.ts b/functions/src/create-user.ts index 54e37d62..216a7eb4 100644 --- a/functions/src/create-user.ts +++ b/functions/src/create-user.ts @@ -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(), diff --git a/functions/src/on-update-user.ts b/functions/src/on-update-user.ts index 3dc09a1b..b45809d0 100644 --- a/functions/src/on-update-user.ts +++ b/functions/src/on-update-user.ts @@ -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 diff --git a/web/pages/notifications.tsx b/web/pages/notifications.tsx index ccfcf1b3..971201e8 100644 --- a/web/pages/notifications.tsx +++ b/web/pages/notifications.tsx @@ -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 (