chore: formatting

This commit is contained in:
あかニャン 2024-05-29 03:12:35 +09:00
parent 08dd7793bc
commit cc465530b5

View File

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