Finish up conversion to use case-sensitive column names

This commit is contained in:
Ajay Ramachandran
2021-03-04 23:29:01 -05:00
parent 2772a9dcc6
commit e9b7eac289
15 changed files with 106 additions and 81 deletions

View File

@@ -23,9 +23,9 @@ async function generateTopUsersStats(sortBy: string, categoryStatsEnabled: boole
"SUM(CASE WHEN category = 'music_offtopic' THEN 1 ELSE 0 END) as categoryMusicOfftopic, ";
}
const rows = await db.prepare('all', `SELECT COUNT(*) as totalSubmissions, SUM(views) as viewCount,
SUM(("sponsorTimes.endTime" - "sponsorTimes.startTime") / 60 * "sponsorTimes.views") as minutesSaved,
SUM("votes") as userVotes, ` +
const rows = await db.prepare('all', `SELECT COUNT(*) as "totalSubmissions", SUM(views) as "viewCount",
SUM(("sponsorTimes.endTime" - "sponsorTimes.startTime") / 60 * "sponsorTimes.views") as "minutesSaved",
SUM("votes") as "userVotes", ` +
additionalFields +
`IFNULL("userNames.userName", "sponsorTimes.userID") as "userName" FROM "sponsorTimes" LEFT JOIN "userNames" ON "sponsorTimes.userID"="userNames.userID"
LEFT JOIN "privateDB.shadowBannedUsers" ON "sponsorTimes.userID"="privateDB.shadowBannedUsers.userID"