improve feed gamelog datebase queri perform

This commit is contained in:
pa
2025-12-20 03:35:04 +09:00
committed by Natsumi
parent c8522f23e2
commit f4e1c745e8
2 changed files with 58 additions and 58 deletions

View File

@@ -21,7 +21,7 @@ const feed = {
time: dbRow[7], time: dbRow[7],
groupName: dbRow[8] groupName: dbRow[8]
}; };
feedDatabase.unshift(row); feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_gps WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`); }, `SELECT * FROM ${dbVars.userPrefix}_feed_gps WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`);
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
var row = { var row = {
@@ -35,7 +35,7 @@ const feed = {
previousStatus: dbRow[6], previousStatus: dbRow[6],
previousStatusDescription: dbRow[7] previousStatusDescription: dbRow[7]
}; };
feedDatabase.unshift(row); feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_status WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`); }, `SELECT * FROM ${dbVars.userPrefix}_feed_status WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`);
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
var row = { var row = {
@@ -47,7 +47,7 @@ const feed = {
bio: dbRow[4], bio: dbRow[4],
previousBio: dbRow[5] previousBio: dbRow[5]
}; };
feedDatabase.unshift(row); feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_bio WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`); }, `SELECT * FROM ${dbVars.userPrefix}_feed_bio WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`);
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
var row = { var row = {
@@ -63,7 +63,7 @@ const feed = {
previousCurrentAvatarImageUrl: dbRow[8], previousCurrentAvatarImageUrl: dbRow[8],
previousCurrentAvatarThumbnailImageUrl: dbRow[9] previousCurrentAvatarThumbnailImageUrl: dbRow[9]
}; };
feedDatabase.unshift(row); feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_avatar WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`); }, `SELECT * FROM ${dbVars.userPrefix}_feed_avatar WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`);
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
var row = { var row = {
@@ -77,7 +77,7 @@ const feed = {
time: dbRow[7], time: dbRow[7],
groupName: dbRow[8] groupName: dbRow[8]
}; };
feedDatabase.unshift(row); feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_online_offline WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`); }, `SELECT * FROM ${dbVars.userPrefix}_feed_online_offline WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`);
var compareByCreatedAt = function (a, b) { var compareByCreatedAt = function (a, b) {
var A = a.created_at; var A = a.created_at;
@@ -175,7 +175,7 @@ const feed = {
}, },
async lookupFeedDatabase(search, filters, vipList) { async lookupFeedDatabase(search, filters, vipList) {
var search = search.replaceAll("'", "''"); search = search.replaceAll("'", "''");
if (search.startsWith('wrld_') || search.startsWith('grp_')) { if (search.startsWith('wrld_') || search.startsWith('grp_')) {
return this.getFeedByInstanceId(search, filters, vipList); return this.getFeedByInstanceId(search, filters, vipList);
} }
@@ -243,7 +243,7 @@ const feed = {
time: dbRow[7], time: dbRow[7],
groupName: dbRow[8] groupName: dbRow[8]
}; };
feedDatabase.unshift(row); feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_gps WHERE (display_name LIKE '%${search}%' OR world_name LIKE '%${search}%' OR group_name LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM ${dbVars.userPrefix}_feed_gps WHERE (display_name LIKE '%${search}%' OR world_name LIKE '%${search}%' OR group_name LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
if (status) { if (status) {
@@ -259,7 +259,7 @@ const feed = {
previousStatus: dbRow[6], previousStatus: dbRow[6],
previousStatusDescription: dbRow[7] previousStatusDescription: dbRow[7]
}; };
feedDatabase.unshift(row); feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_status WHERE (display_name LIKE '%${search}%' OR status LIKE '%${search}%' OR status_description LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM ${dbVars.userPrefix}_feed_status WHERE (display_name LIKE '%${search}%' OR status LIKE '%${search}%' OR status_description LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
if (bio) { if (bio) {
@@ -273,15 +273,15 @@ const feed = {
bio: dbRow[4], bio: dbRow[4],
previousBio: dbRow[5] previousBio: dbRow[5]
}; };
feedDatabase.unshift(row); feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_bio WHERE (display_name LIKE '%${search}%' OR bio LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM ${dbVars.userPrefix}_feed_bio WHERE (display_name LIKE '%${search}%' OR bio LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
if (avatar) { if (avatar) {
var query = ''; var avatarQuery = '';
if (aviPrivate) { if (aviPrivate) {
query = 'OR user_id = owner_id'; avatarQuery = 'OR user_id = owner_id';
} else if (aviPublic) { } else if (aviPublic) {
query = 'OR user_id != owner_id'; avatarQuery = 'OR user_id != owner_id';
} }
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
var row = { var row = {
@@ -297,8 +297,8 @@ const feed = {
previousCurrentAvatarImageUrl: dbRow[8], previousCurrentAvatarImageUrl: dbRow[8],
previousCurrentAvatarThumbnailImageUrl: dbRow[9] previousCurrentAvatarThumbnailImageUrl: dbRow[9]
}; };
feedDatabase.unshift(row); feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_avatar WHERE ((display_name LIKE '%${search}%' OR avatar_name LIKE '%${search}%') ${query}) ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM ${dbVars.userPrefix}_feed_avatar WHERE ((display_name LIKE '%${search}%' OR avatar_name LIKE '%${search}%') ${avatarQuery}) ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
if (online || offline) { if (online || offline) {
var query = ''; var query = '';
@@ -321,7 +321,7 @@ const feed = {
time: dbRow[7], time: dbRow[7],
groupName: dbRow[8] groupName: dbRow[8]
}; };
feedDatabase.unshift(row); feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_online_offline WHERE ((display_name LIKE '%${search}%' OR world_name LIKE '%${search}%' OR group_name LIKE '%${search}%') ${query}) ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM ${dbVars.userPrefix}_feed_online_offline WHERE ((display_name LIKE '%${search}%' OR world_name LIKE '%${search}%' OR group_name LIKE '%${search}%') ${query}) ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
var compareByCreatedAt = function (a, b) { var compareByCreatedAt = function (a, b) {
@@ -336,7 +336,9 @@ const feed = {
return 0; return 0;
}; };
feedDatabase.sort(compareByCreatedAt); feedDatabase.sort(compareByCreatedAt);
feedDatabase.splice(0, feedDatabase.length - dbVars.maxTableSize); if (feedDatabase.length > dbVars.maxTableSize) {
feedDatabase.splice(0, feedDatabase.length - dbVars.maxTableSize);
}
return feedDatabase; return feedDatabase;
}, },
@@ -388,7 +390,7 @@ const feed = {
time: dbRow[7], time: dbRow[7],
groupName: dbRow[8] groupName: dbRow[8]
}; };
feedDatabase.unshift(row); feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_gps WHERE location LIKE '%${instanceId}%' ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM ${dbVars.userPrefix}_feed_gps WHERE location LIKE '%${instanceId}%' ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
if (online || offline) { if (online || offline) {
@@ -412,7 +414,7 @@ const feed = {
time: dbRow[7], time: dbRow[7],
groupName: dbRow[8] groupName: dbRow[8]
}; };
feedDatabase.unshift(row); feedDatabase.push(row);
}, `SELECT * FROM ${dbVars.userPrefix}_feed_online_offline WHERE (location LIKE '%${instanceId}%' ${query}) ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM ${dbVars.userPrefix}_feed_online_offline WHERE (location LIKE '%${instanceId}%' ${query}) ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
var compareByCreatedAt = function (a, b) { var compareByCreatedAt = function (a, b) {
@@ -427,7 +429,9 @@ const feed = {
return 0; return 0;
}; };
feedDatabase.sort(compareByCreatedAt); feedDatabase.sort(compareByCreatedAt);
feedDatabase.splice(0, feedDatabase.length - dbVars.maxTableSize); if (feedDatabase.length > dbVars.maxTableSize) {
feedDatabase.splice(0, feedDatabase.length - dbVars.maxTableSize);
}
return feedDatabase; return feedDatabase;
} }
}; };

View File

@@ -19,8 +19,8 @@ const gameLog = {
time: dbRow[5], time: dbRow[5],
groupName: dbRow[6] groupName: dbRow[6]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_location WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`); }, `SELECT * FROM gamelog_location WHERE created_at >= date('${dateOffset}') ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
var row = { var row = {
rowId: dbRow[0], rowId: dbRow[0],
@@ -31,8 +31,8 @@ const gameLog = {
userId: dbRow[5], userId: dbRow[5],
time: dbRow[6] time: dbRow[6]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_join_leave WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`); }, `SELECT * FROM gamelog_join_leave WHERE created_at >= date('${dateOffset}') ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
var row = { var row = {
rowId: dbRow[0], rowId: dbRow[0],
@@ -44,8 +44,8 @@ const gameLog = {
instanceId: dbRow[5], instanceId: dbRow[5],
worldName: dbRow[6] worldName: dbRow[6]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_portal_spawn WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`); }, `SELECT * FROM gamelog_portal_spawn WHERE created_at >= date('${dateOffset}') ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
var row = { var row = {
rowId: dbRow[0], rowId: dbRow[0],
@@ -58,8 +58,8 @@ const gameLog = {
displayName: dbRow[6], displayName: dbRow[6],
userId: dbRow[7] userId: dbRow[7]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_video_play WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`); }, `SELECT * FROM gamelog_video_play WHERE created_at >= date('${dateOffset}') ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
var row = { var row = {
rowId: dbRow[0], rowId: dbRow[0],
@@ -68,8 +68,8 @@ const gameLog = {
resourceUrl: dbRow[2], resourceUrl: dbRow[2],
location: dbRow[4] location: dbRow[4]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_resource_load WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`); }, `SELECT * FROM gamelog_resource_load WHERE created_at >= date('${dateOffset}') ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
var row = { var row = {
rowId: dbRow[0], rowId: dbRow[0],
@@ -77,8 +77,8 @@ const gameLog = {
type: 'Event', type: 'Event',
data: dbRow[2] data: dbRow[2]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_event WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`); }, `SELECT * FROM gamelog_event WHERE created_at >= date('${dateOffset}') ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
var row = { var row = {
rowId: dbRow[0], rowId: dbRow[0],
@@ -89,8 +89,8 @@ const gameLog = {
userId: dbRow[4], userId: dbRow[4],
location: dbRow[5] location: dbRow[5]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_external WHERE created_at >= date('${dateOffset}') ORDER BY id DESC`); }, `SELECT * FROM gamelog_external WHERE created_at >= date('${dateOffset}') ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
var compareByCreatedAt = function (a, b) { var compareByCreatedAt = function (a, b) {
var A = a.created_at; var A = a.created_at;
var B = b.created_at; var B = b.created_at;
@@ -241,11 +241,7 @@ const gameLog = {
}, },
async getLastVisit(worldId, currentWorldMatch) { async getLastVisit(worldId, currentWorldMatch) {
if (currentWorldMatch) { var count = currentWorldMatch ? 2 : 1;
var count = 2;
} else {
var count = 1;
}
var ref = { var ref = {
created_at: '', created_at: '',
worldId: '' worldId: ''
@@ -569,7 +565,7 @@ const gameLog = {
time: dbRow[5], time: dbRow[5],
groupName: dbRow[6] groupName: dbRow[6]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_location WHERE location LIKE '%${instanceId}%' ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM gamelog_location WHERE location LIKE '%${instanceId}%' ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
if (onplayerjoined || onplayerleft) { if (onplayerjoined || onplayerleft) {
@@ -591,7 +587,7 @@ const gameLog = {
userId: dbRow[5], userId: dbRow[5],
time: dbRow[6] time: dbRow[6]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_join_leave WHERE (location LIKE '%${instanceId}%' AND user_id != '${dbVars.userId}') ${query} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM gamelog_join_leave WHERE (location LIKE '%${instanceId}%' AND user_id != '${dbVars.userId}') ${query} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
if (portalspawn) { if (portalspawn) {
@@ -606,7 +602,7 @@ const gameLog = {
instanceId: dbRow[5], instanceId: dbRow[5],
worldName: dbRow[6] worldName: dbRow[6]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_portal_spawn WHERE location LIKE '%${instanceId}%' ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM gamelog_portal_spawn WHERE location LIKE '%${instanceId}%' ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
if (videoplay) { if (videoplay) {
@@ -622,7 +618,7 @@ const gameLog = {
displayName: dbRow[6], displayName: dbRow[6],
userId: dbRow[7] userId: dbRow[7]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_video_play WHERE location LIKE '%${instanceId}%' ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM gamelog_video_play WHERE location LIKE '%${instanceId}%' ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
if (resourceload_string || resourceload_image) { if (resourceload_string || resourceload_image) {
@@ -642,7 +638,7 @@ const gameLog = {
resourceUrl: dbRow[2], resourceUrl: dbRow[2],
location: dbRow[4] location: dbRow[4]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_resource_load WHERE location LIKE '%${instanceId}%' ${checkString} ${checkImage} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM gamelog_resource_load WHERE location LIKE '%${instanceId}%' ${checkString} ${checkImage} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
var compareByCreatedAt = function (a, b) { var compareByCreatedAt = function (a, b) {
@@ -670,7 +666,7 @@ const gameLog = {
*/ */
async lookupGameLogDatabase(search, filters, vipList = []) { async lookupGameLogDatabase(search, filters, vipList = []) {
var search = search.replaceAll("'", "''"); search = search.replaceAll("'", "''");
if (search.startsWith('wrld_') || search.startsWith('grp_')) { if (search.startsWith('wrld_') || search.startsWith('grp_')) {
return this.getGameLogByLocation(search, filters); return this.getGameLogByLocation(search, filters);
} }
@@ -749,7 +745,7 @@ const gameLog = {
time: dbRow[5], time: dbRow[5],
groupName: dbRow[6] groupName: dbRow[6]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_location WHERE world_name LIKE '%${search}%' OR group_name LIKE '%${search}%' ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM gamelog_location WHERE world_name LIKE '%${search}%' OR group_name LIKE '%${search}%' ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
if (onplayerjoined || onplayerleft) { if (onplayerjoined || onplayerleft) {
@@ -771,7 +767,7 @@ const gameLog = {
userId: dbRow[5], userId: dbRow[5],
time: dbRow[6] time: dbRow[6]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_join_leave WHERE (display_name LIKE '%${search}%' AND user_id != '${dbVars.userId}') ${vipQuery} ${query} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM gamelog_join_leave WHERE (display_name LIKE '%${search}%' AND user_id != '${dbVars.userId}') ${vipQuery} ${query} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
if (portalspawn) { if (portalspawn) {
@@ -786,7 +782,7 @@ const gameLog = {
instanceId: dbRow[5], instanceId: dbRow[5],
worldName: dbRow[6] worldName: dbRow[6]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_portal_spawn WHERE (display_name LIKE '%${search}%' OR world_name LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM gamelog_portal_spawn WHERE (display_name LIKE '%${search}%' OR world_name LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
if (msgevent) { if (msgevent) {
@@ -797,7 +793,7 @@ const gameLog = {
type: 'Event', type: 'Event',
data: dbRow[2] data: dbRow[2]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_event WHERE data LIKE '%${search}%' ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM gamelog_event WHERE data LIKE '%${search}%' ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
if (external) { if (external) {
@@ -811,7 +807,7 @@ const gameLog = {
userId: dbRow[4], userId: dbRow[4],
location: dbRow[5] location: dbRow[5]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_external WHERE (display_name LIKE '%${search}%' OR message LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM gamelog_external WHERE (display_name LIKE '%${search}%' OR message LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
if (videoplay) { if (videoplay) {
@@ -827,7 +823,7 @@ const gameLog = {
displayName: dbRow[6], displayName: dbRow[6],
userId: dbRow[7] userId: dbRow[7]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_video_play WHERE (video_url LIKE '%${search}%' OR video_name LIKE '%${search}%' OR display_name LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM gamelog_video_play WHERE (video_url LIKE '%${search}%' OR video_name LIKE '%${search}%' OR display_name LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
if (resourceload_string || resourceload_image) { if (resourceload_string || resourceload_image) {
@@ -847,7 +843,7 @@ const gameLog = {
resourceUrl: dbRow[2], resourceUrl: dbRow[2],
location: dbRow[4] location: dbRow[4]
}; };
gamelogDatabase.unshift(row); gamelogDatabase.push(row);
}, `SELECT * FROM gamelog_resource_load WHERE resource_url LIKE '%${search}%' ${checkString} ${checkImage} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`); }, `SELECT * FROM gamelog_resource_load WHERE resource_url LIKE '%${search}%' ${checkString} ${checkImage} ORDER BY id DESC LIMIT ${dbVars.maxTableSize}`);
} }
var compareByCreatedAt = function (a, b) { var compareByCreatedAt = function (a, b) {
@@ -871,22 +867,22 @@ const gameLog = {
var date = new Date().toJSON(); var date = new Date().toJSON();
var dateOffset = new Date(Date.now() - 86400000).toJSON(); // 24 hours var dateOffset = new Date(Date.now() - 86400000).toJSON(); // 24 hours
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
gamelogDatabase.unshift(dbRow[0]); gamelogDatabase.push(dbRow[0]);
}, 'SELECT created_at FROM gamelog_location ORDER BY id DESC LIMIT 1'); }, 'SELECT created_at FROM gamelog_location ORDER BY id DESC LIMIT 1');
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
gamelogDatabase.unshift(dbRow[0]); gamelogDatabase.push(dbRow[0]);
}, 'SELECT created_at FROM gamelog_join_leave ORDER BY id DESC LIMIT 1'); }, 'SELECT created_at FROM gamelog_join_leave ORDER BY id DESC LIMIT 1');
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
gamelogDatabase.unshift(dbRow[0]); gamelogDatabase.push(dbRow[0]);
}, 'SELECT created_at FROM gamelog_portal_spawn ORDER BY id DESC LIMIT 1'); }, 'SELECT created_at FROM gamelog_portal_spawn ORDER BY id DESC LIMIT 1');
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
gamelogDatabase.unshift(dbRow[0]); gamelogDatabase.push(dbRow[0]);
}, 'SELECT created_at FROM gamelog_event ORDER BY id DESC LIMIT 1'); }, 'SELECT created_at FROM gamelog_event ORDER BY id DESC LIMIT 1');
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
gamelogDatabase.unshift(dbRow[0]); gamelogDatabase.push(dbRow[0]);
}, 'SELECT created_at FROM gamelog_video_play ORDER BY id DESC LIMIT 1'); }, 'SELECT created_at FROM gamelog_video_play ORDER BY id DESC LIMIT 1');
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
gamelogDatabase.unshift(dbRow[0]); gamelogDatabase.push(dbRow[0]);
}, 'SELECT created_at FROM gamelog_resource_load ORDER BY id DESC LIMIT 1'); }, 'SELECT created_at FROM gamelog_resource_load ORDER BY id DESC LIMIT 1');
if (gamelogDatabase.length > 0) { if (gamelogDatabase.length > 0) {
gamelogDatabase.sort(); gamelogDatabase.sort();
@@ -1157,7 +1153,7 @@ const gameLog = {
/** /**
* Get the All Date of Instance Activity for the current user * Get the All Date of Instance Activity for the current user
* @returns {Promise<null>} * @returns {Promise<string[]>}
*/ */
async getDateOfInstanceActivity() { async getDateOfInstanceActivity() {
let result = []; let result = [];