feat: add Exclude home world for activity tab

This commit is contained in:
pa
2026-03-23 11:23:14 +09:00
parent fb4750e9bc
commit 520c41f280
6 changed files with 173 additions and 36 deletions

View File

@@ -1449,18 +1449,23 @@ const gameLog = {
* @param {number} [days] - Number of days to look back. Omit or 0 for all time.
* @param {number} [limit=5] - Maximum number of worlds to return.
* @param {'time'|'count'} [sortBy='time'] - Sort by total time or visit count.
* @param {string} [excludeWorldId=''] - Optional world ID to exclude from results.
* @returns {Promise<Array<{worldId: string, worldName: string, visitCount: number, totalTime: number}>>}
*/
async getMyTopWorlds(days = 0, limit = 5, sortBy = 'time') {
async getMyTopWorlds(days = 0, limit = 5, sortBy = 'time', excludeWorldId = '') {
const results = [];
const whereClause =
days > 0 ? `AND created_at >= datetime('now', @daysOffset)` : '';
const excludeClause = excludeWorldId ? 'AND world_id != @excludeWorldId' : '';
const orderBy =
sortBy === 'count' ? 'visit_count DESC' : 'total_time DESC';
const params = { '@limit': limit };
if (days > 0) {
params['@daysOffset'] = `-${days} days`;
}
if (excludeWorldId) {
params['@excludeWorldId'] = excludeWorldId;
}
await sqliteService.execute(
(dbRow) => {
results.push({
@@ -1480,6 +1485,7 @@ const gameLog = {
AND world_id != ''
AND world_id LIKE 'wrld_%'
${whereClause}
${excludeClause}
GROUP BY world_id
ORDER BY ${orderBy}
LIMIT @limit`,