File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -740,6 +740,19 @@ export const getUserRankingAcrossAllRankings = async function(prisma: PrismaClie
740740} ;
741741
742742export const bonusPointsAwardingStarted = async function ( prisma : PrismaClient , atDateTime : Date = new Date ( ) ) : Promise < { started : boolean , startTime : Date | null } > {
743+ // Check if there are any rankings that award bonus points at all
744+ const rankingsAwardingBonusPointsCount = await prisma . codamCoalitionRanking . count ( {
745+ where : {
746+ bonus_points : {
747+ gt : 0 ,
748+ } ,
749+ } ,
750+ } ) ;
751+ if ( rankingsAwardingBonusPointsCount === 0 ) {
752+ return { started : false , startTime : null } ;
753+ }
754+
755+
743756 // Calculate when the bonus points awarding will start (7 days prior to end of the bloc)
744757 const blocAtDate = await getBlocAtDate ( prisma , atDateTime ) ;
745758 const bonusPointsAwardingStartTime = blocAtDate ? new Date ( blocAtDate . end_at . getTime ( ) - 7 * 24 * 60 * 60 * 1000 ) : null ;
You can’t perform that action at this time.
0 commit comments