修正人氣排行的數量問題
This commit is contained in:
@@ -376,10 +376,11 @@ export function PopularityRankings() {
|
||||
|
||||
const currentPage = teamCurrentPage
|
||||
const setCurrentPage = setTeamCurrentPage
|
||||
const totalPages = Math.ceil(teamsWithScores.length / ITEMS_PER_PAGE)
|
||||
const validTeams = teamsWithScores.filter(team => team && team.id)
|
||||
const totalPages = Math.ceil(validTeams.length / ITEMS_PER_PAGE)
|
||||
const startIndex = currentPage * ITEMS_PER_PAGE
|
||||
const endIndex = startIndex + ITEMS_PER_PAGE
|
||||
const currentTeams = teamsWithScores.slice(startIndex, endIndex)
|
||||
const currentTeams = validTeams.slice(startIndex, endIndex)
|
||||
|
||||
return (
|
||||
<Card className="mb-8">
|
||||
@@ -391,7 +392,7 @@ export function PopularityRankings() {
|
||||
<span>{title}</span>
|
||||
</CardTitle>
|
||||
<CardDescription>
|
||||
{currentCompetition?.name || "暫無進行中的競賽"} - {title}人氣排名 (共 {teamsWithScores.length} 個團隊)
|
||||
{currentCompetition?.name || "暫無進行中的競賽"} - {title}人氣排名 (共 {teamsWithScores.filter(team => team && team.id).length} 個團隊)
|
||||
</CardDescription>
|
||||
</div>
|
||||
<div className="flex items-center space-x-3">
|
||||
@@ -408,7 +409,7 @@ export function PopularityRankings() {
|
||||
{totalPages > 1 && (
|
||||
<div className="text-center">
|
||||
<div className="text-sm text-gray-600">
|
||||
顯示第 {startIndex + 1}-{Math.min(endIndex, teamsWithScores.length)} 名,共 {teamsWithScores.length}{" "}
|
||||
顯示第 {startIndex + 1}-{Math.min(endIndex, teamsWithScores.filter(team => team && team.id).length)} 名,共 {teamsWithScores.filter(team => team && team.id).length}{" "}
|
||||
個團隊
|
||||
</div>
|
||||
<div className="flex justify-center items-center space-x-2 mt-2">
|
||||
@@ -638,7 +639,7 @@ export function PopularityRankings() {
|
||||
<Users className="w-4 h-4 text-gray-500" />
|
||||
<span className="text-sm">
|
||||
{currentCompetition.type === 'team'
|
||||
? `${competitionTeams.length} 個參賽團隊`
|
||||
? `${competitionTeams.filter(team => team && team.id).length} 個參賽團隊`
|
||||
: `${filteredApps.length} 個參賽應用`}
|
||||
</span>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user