Skip to content

Commit

Permalink
탐사 필요 쿼리 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
wook-hyung committed Dec 18, 2023
1 parent 5812f69 commit 0d34130
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions models/challengeModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,8 @@ const challengeModel = {
const connection = await pool.getConnection();

try {
// const [rows, fields] = await connection.query(
// `SELECT COUNT(DISTINCT cT.id) FROM challenge cT LEFT JOIN challenge_participant cpT ON cT.id = cpT.challenge_id LEFT JOIN member m ON cpT.member_id = m.id WHERE m.id = 22 AND cT.challenge_status = "PROGRESS";`,
// [memberId]
// );

const [rows, fields] = await connection.query(
`SELECT COUNT(DISTINCT cT.id) FROM challenge cT LEFT JOIN challenge_participant cpT ON cT.id = cpT.challenge_id LEFT JOIN member m ON cpT.member_id = m.id LEFT JOIN challenge_certification ccT ON cT.id = ccT.challenge_id WHERE m.id = 22 AND cT.challenge_status = 'PROGRESS' AND (ccT.is_authenticate IS NULL OR (ccT.is_authenticate = FALSE AND ccT.updated_at < CURDATE()));`,
`SELECT COUNT(DISTINCT cT.id) FROM challenge cT LEFT JOIN challenge_participant cpT ON cT.id = cpT.challenge_id LEFT JOIN member m ON cpT.member_id = m.id LEFT JOIN challenge_certification ccT ON cT.id = ccT.challenge_id WHERE m.id = ? AND cT.challenge_status = 'PROGRESS' AND (ccT.is_authenticate IS NULL OR (ccT.is_authenticate = FALSE AND ccT.updated_at < CURDATE()));`,
[memberId]
);

Expand Down

0 comments on commit 0d34130

Please sign in to comment.