fix: include today's completed matches in recentMatches
lt(date, today) excluded same-day results once the live window closed. Changed to lte so finished matches from today appear on the homepage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { db } from '@/lib/db'
|
import { db } from '@/lib/db'
|
||||||
import { tournaments, teams, matches, goals, groupStandings, stadiums, squads } from '@/lib/db/schema'
|
import { tournaments, teams, matches, goals, groupStandings, stadiums, squads } from '@/lib/db/schema'
|
||||||
import { slugify, getIso } from '@/lib/iso-codes'
|
import { slugify, getIso } from '@/lib/iso-codes'
|
||||||
import { eq, and, desc, asc, sql, ilike, or, isNotNull, lt, gt, gte } from 'drizzle-orm'
|
import { eq, and, desc, asc, sql, ilike, or, isNotNull, lt, lte, gt, gte } from 'drizzle-orm'
|
||||||
|
|
||||||
function teamWithSlug(t: typeof teams.$inferSelect) {
|
function teamWithSlug(t: typeof teams.$inferSelect) {
|
||||||
return { ...t, slug: slugify(t.name), iso2: t.iso2 ?? getIso(t.name) }
|
return { ...t, slug: slugify(t.name), iso2: t.iso2 ?? getIso(t.name) }
|
||||||
@@ -116,7 +116,7 @@ export const resolvers = {
|
|||||||
const today = new Date().toISOString().slice(0, 10)
|
const today = new Date().toISOString().slice(0, 10)
|
||||||
const rows = await db.select().from(matches)
|
const rows = await db.select().from(matches)
|
||||||
.where(and(
|
.where(and(
|
||||||
lt(matches.date, today),
|
lte(matches.date, today),
|
||||||
isNotNull(matches.scoreFtHome),
|
isNotNull(matches.scoreFtHome),
|
||||||
eq(matches.isQualiPlayoff, false),
|
eq(matches.isQualiPlayoff, false),
|
||||||
))
|
))
|
||||||
|
|||||||
Reference in New Issue
Block a user