Skip to content

Commit e44d12f

Browse files
committed
feat(homepage): coalesce root and transcript statistics for top items query
1 parent 60e4273 commit e44d12f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • apps/site/src/lib/sanity/queries

‎apps/site/src/lib/sanity/queries/pages.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ export const homePageQuery = defineQuery(`*[_type == "settings" ][0]{
2121
"latestPodcasts": *[_type == "podcast"]|order(date desc)[0...4]{
2222
${baseFieldsNoContent},
2323
},
24-
"topPodcasts": *[_type == "podcast" && statistics.youtube.viewCount > 0]|order(statistics.youtube.viewCount desc)[0...4]{
24+
"topPodcasts": *[_type == "podcast" && coalesce(statistics.youtube.viewCount, transcript->statistics.viewCount, 0) > 0]|order(coalesce(statistics.youtube.viewCount, transcript->statistics.viewCount, 0) desc)[0...4]{
2525
${baseFieldsNoContent},
2626
},
2727
"latestPosts": *[_type == "post"]|order(date desc)[0...4]{
2828
${baseFieldsNoContent},
2929
},
30-
"topPosts": *[_type == "post" && statistics.youtube.viewCount > 0]|order(statistics.youtube.viewCount desc)[0...4]{
30+
"topPosts": *[_type == "post" && coalesce(statistics.youtube.viewCount, transcript->statistics.viewCount, 0) > 0]|order(coalesce(statistics.youtube.viewCount, transcript->statistics.viewCount, 0) desc)[0...4]{
3131
${baseFieldsNoContent},
3232
},
3333
}`);

0 commit comments

Comments
 (0)