chuni: fix lost scores for real

This commit is contained in:
cd6c1fd2d946dff292b101ca3305fc7f31d2dce5 2020-04-19 23:03:31 +08:00
parent ac9cf50d28
commit 834804b2ea
2 changed files with 14 additions and 6 deletions

View File

@ -23,7 +23,7 @@ export default async function getGameSetting(
isBackgroundDistribute: "false",
maxCountCharacter: "300",
maxCountItem: "300",
maxCountMusic: "300",
maxCountMusic: "100",
},
isDumpUpload: "false",
isAou: "false",

View File

@ -34,14 +34,22 @@ export class SqlUserMusicRepository implements UserMusicRepository {
profileId: Id<UserDataItem>,
page?: Page
): Promise<UserMusicDetailItem[]> {
const preStmt = sql
.select("DISTINCT(music_id)")
.from("cm_user_music")
.where("profile_id", profileId)
.orderBy("music_id");
if (page) {
preStmt.limit(page.limit).offset(page.offset);
}
const preRows = await this._txn.fetchRows(preStmt);
const musicIds = preRows.map(r => r.music_id);
const stmt = sql
.select("*")
.from("cm_user_music")
.where("profile_id", profileId);
if (page) {
stmt.limit(page.limit).offset(page.offset);
}
.where("profile_id", profileId)
.and(sql.in('music_id', musicIds));
const rows = await this._txn.fetchRows(stmt);