@@ -6,7 +6,7 @@ import { firestoreAdmin } from '@/firebase-admin';
6
6
import { WebsiteLanguage , WebsiteRegion } from '@/i18n' ;
7
7
import { getMetadata } from '@/metadata' ;
8
8
import { Campaign , CAMPAIGN_FIRESTORE_PATH , CampaignStatus } from '@socialincome/shared/src/types/campaign' ;
9
- import { Contribution } from '@socialincome/shared/src/types/contribution' ;
9
+ import { Contribution , CONTRIBUTION_FIRESTORE_PATH } from '@socialincome/shared/src/types/contribution' ;
10
10
import { daysUntilTs } from '@socialincome/shared/src/utils/date' ;
11
11
import { getLatestExchangeRate } from '@socialincome/shared/src/utils/exchangeRates' ;
12
12
import { Translator } from '@socialincome/shared/src/utils/i18n' ;
@@ -87,7 +87,7 @@ export default async function Page({ params }: CampaignPageProps) {
87
87
: 1.0 ;
88
88
89
89
const contributions = await firestoreAdmin
90
- . collectionGroup < Contribution > ( 'contributions' )
90
+ . collectionGroup < Contribution > ( CONTRIBUTION_FIRESTORE_PATH )
91
91
. where ( 'campaign_path' , '==' , firestoreAdmin . firestore . doc ( [ CAMPAIGN_FIRESTORE_PATH , params . campaign ] . join ( '/' ) ) )
92
92
. get ( ) ;
93
93
const amountCollected = ( contributions . docs . reduce ( ( sum , c ) => sum + c . data ( ) . amount_chf , 0 ) ?? 0 ) * exchangeRate ;
@@ -126,7 +126,7 @@ export default async function Page({ params }: CampaignPageProps) {
126
126
< Typography size = "2xl" weight = "medium" color = "secondary" >
127
127
{ translator ?. t ( 'campaign.without-goal.collected' , {
128
128
context : {
129
- count : contributions . size ,
129
+ count : contributions . docs . length ,
130
130
amount : amountCollected ,
131
131
currency : campaign . goal_currency ,
132
132
total : campaign . goal ,
0 commit comments