diff --git a/index.ts b/index.ts index 9cc0a2e..9c431dd 100644 --- a/index.ts +++ b/index.ts @@ -19,13 +19,13 @@ interface ArtemisPlaylog extends RowDataPacket { const fetchArtemis = async (conn: mysql.Connection, userId: number) => { const [ bestScores ] = await conn.query( - 'select \ - musicId, \ - level, \ - clearStatus \ - from ongeki_score_best \ - where user=? \ - ', [userId] + `select + musicId, + level, + clearStatus + from ongeki_score_best + where user=?`, + [userId] ); let n = 0; @@ -34,21 +34,22 @@ const fetchArtemis = async (conn: mysql.Connection, userId: number) => { continue; } const [ playlogs ] = await conn.query( - `select \ - clearStatus \ - from ongeki_score_playlog \ + `select + clearStatus + from ongeki_score_playlog where user=? and musicId=? and level=? order by clearStatus desc - limit 1 - `, [userId, best.musicId, best.level] + limit 1`, + [userId, best.musicId, best.level] ); if(playlogs.length > 0 && playlogs[0].clearStatus === 2) { await conn.query( - `update ongeki_score_best \ + `update ongeki_score_best set clearStatus=1 - where user=? and musicId=? and level=?` - , [userId, best.musicId, best.level]); + where user=? and musicId=? and level=?`, + [userId, best.musicId, best.level] + ); n += 1; } } @@ -81,7 +82,10 @@ const main = async () => { charset: 'utf8mb4' }); - const [ profiles ] = await conn.query('select user from ongeki_profile_data'); + const [ profiles ] = await conn.query( + `select user + from ongeki_profile_data` + ); for(const profile of profiles) { await fetchArtemis(conn, profile.user);