修正獎勵評審資訊、評分資訊
This commit is contained in:
@@ -4572,14 +4572,19 @@ export class AwardService extends DatabaseServiceBase {
|
||||
const simpleResult = await db.query<Award>(simpleSql);
|
||||
console.log('✅ 簡單查詢結果:', simpleResult?.length || 0, '個獎項');
|
||||
|
||||
// 再執行 JOIN 查詢
|
||||
// 再執行 JOIN 查詢,包含團隊資訊
|
||||
const sql = `
|
||||
SELECT
|
||||
a.*,
|
||||
c.name as competition_name,
|
||||
c.type as competition_type
|
||||
c.type as competition_type,
|
||||
c.description as competition_description,
|
||||
c.start_date as competition_start_date,
|
||||
c.end_date as competition_end_date,
|
||||
t.name as team_name_from_teams
|
||||
FROM awards a
|
||||
LEFT JOIN competitions c ON a.competition_id = c.id
|
||||
LEFT JOIN teams t ON a.team_id = t.id
|
||||
ORDER BY a.created_at DESC
|
||||
`;
|
||||
console.log('📝 執行JOIN查詢:', sql);
|
||||
@@ -4605,7 +4610,21 @@ export class AwardService extends DatabaseServiceBase {
|
||||
|
||||
// 根據競賽獲取獎項
|
||||
static async getAwardsByCompetition(competitionId: string): Promise<Award[]> {
|
||||
const sql = 'SELECT * FROM awards WHERE competition_id = ? ORDER BY created_at DESC';
|
||||
const sql = `
|
||||
SELECT
|
||||
a.*,
|
||||
c.name as competition_name,
|
||||
c.type as competition_type,
|
||||
c.description as competition_description,
|
||||
c.start_date as competition_start_date,
|
||||
c.end_date as competition_end_date,
|
||||
t.name as team_name_from_teams
|
||||
FROM awards a
|
||||
LEFT JOIN competitions c ON a.competition_id = c.id
|
||||
LEFT JOIN teams t ON a.team_id = t.id
|
||||
WHERE a.competition_id = ?
|
||||
ORDER BY a.created_at DESC
|
||||
`;
|
||||
return await db.query<Award>(sql, [competitionId]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user