修正人氣排行的數量問題
This commit is contained in:
@@ -1727,16 +1727,15 @@ export class CompetitionService extends DatabaseServiceBase {
|
||||
ct.registered_at,
|
||||
u.name as leader_name,
|
||||
u.phone as leader_phone,
|
||||
COUNT(tm.id) as actual_member_count,
|
||||
a.id as app_id,
|
||||
a.name as app_name
|
||||
COUNT(DISTINCT tm.id) as actual_member_count,
|
||||
COUNT(DISTINCT a.id) as app_count
|
||||
FROM competition_teams ct
|
||||
JOIN teams t ON ct.team_id = t.id
|
||||
LEFT JOIN users u ON t.leader_id = u.id
|
||||
LEFT JOIN team_members tm ON t.id = tm.team_id
|
||||
LEFT JOIN apps a ON t.id = a.team_id AND a.is_active = 1
|
||||
WHERE ct.competition_id = ? AND t.is_active = 1
|
||||
GROUP BY t.id, ct.registered_at, u.name, u.phone, a.id, a.name
|
||||
GROUP BY t.id, t.name, t.leader_id, t.department, t.contact_email, t.total_likes, t.is_active, t.created_at, t.updated_at, ct.registered_at, u.name, u.phone
|
||||
ORDER BY ct.registered_at ASC
|
||||
`;
|
||||
return await DatabaseServiceBase.safeQuery(sql, [competitionId]);
|
||||
|
Reference in New Issue
Block a user