From 59f3936dad81ed4686685dfb187aadd5b5a29ec5 Mon Sep 17 00:00:00 2001 From: FRC Date: Tue, 6 Sep 2022 14:17:21 +0100 Subject: [PATCH] Fix bug (#854) --- web/lib/firebase/contracts.ts | 5 +++-- web/pages/tournaments/index.tsx | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/web/lib/firebase/contracts.ts b/web/lib/firebase/contracts.ts index 702f1c99..51ec3108 100644 --- a/web/lib/firebase/contracts.ts +++ b/web/lib/firebase/contracts.ts @@ -104,7 +104,7 @@ export async function listContracts(creatorId: string): Promise { return snapshot.docs.map((doc) => doc.data()) } -export const contractsByGroupSlugQuery = (slug: string) => +export const tournamentContractsByGroupSlugQuery = (slug: string) => query( contracts, where('groupSlugs', 'array-contains', slug), @@ -115,7 +115,8 @@ export const contractsByGroupSlugQuery = (slug: string) => export async function listContractsByGroupSlug( slug: string ): Promise { - const snapshot = await getDocs(contractsByGroupSlugQuery(slug)) + const q = query(contracts, where('groupSlugs', 'array-contains', slug)) + const snapshot = await getDocs(q) return snapshot.docs.map((doc) => doc.data()) } diff --git a/web/pages/tournaments/index.tsx b/web/pages/tournaments/index.tsx index 1a74e8ea..4b573e3f 100644 --- a/web/pages/tournaments/index.tsx +++ b/web/pages/tournaments/index.tsx @@ -14,7 +14,7 @@ import { Col } from 'web/components/layout/col' import { Row } from 'web/components/layout/row' import { Page } from 'web/components/page' import { SEO } from 'web/components/SEO' -import { contractsByGroupSlugQuery } from 'web/lib/firebase/contracts' +import { tournamentContractsByGroupSlugQuery } from 'web/lib/firebase/contracts' import { getGroup, groupPath } from 'web/lib/firebase/groups' import elon_pic from './_cspi/Will_Elon_Buy_Twitter.png' import china_pic from './_cspi/Chinese_Military_Action_against_Taiwan.png' @@ -222,7 +222,7 @@ const ImageCarousel = (props: { images: MarketImage[]; url: string }) => { const MarketCarousel = (props: { slug: string }) => { const { slug } = props - const q = contractsByGroupSlugQuery(slug) + const q = tournamentContractsByGroupSlugQuery(slug) const { allItems, getNext } = usePagination({ q, pageSize: 6 }) const items = allItems()