mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-30 12:13:48 +02:00
feat: Add online overlap visualization in user activity tab
This commit is contained in:
@@ -606,6 +606,23 @@ const feed = {
|
||||
return data;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get Online and Offline events for a user to build sessions
|
||||
* @param {string} userId
|
||||
* @returns {Promise<Array<{created_at: string, type: string}>>}
|
||||
*/
|
||||
async getOnlineOfflineSessions(userId) {
|
||||
const data = [];
|
||||
await sqliteService.execute(
|
||||
(dbRow) => {
|
||||
data.push({ created_at: dbRow[0], type: dbRow[1] });
|
||||
},
|
||||
`SELECT created_at, type FROM ${dbVars.userPrefix}_feed_online_offline WHERE user_id = @userId AND (type = 'Online' OR type = 'Offline') ORDER BY created_at`,
|
||||
{ '@userId': userId }
|
||||
);
|
||||
return data;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {number} days - Number of days to look back
|
||||
* @param {number} limit - Max number of worlds to return
|
||||
|
||||
@@ -1372,6 +1372,23 @@ const gameLog = {
|
||||
return instances;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get current user's online sessions from gamelog_location
|
||||
* Each row has created_at (leave time) and time (duration in ms)
|
||||
* Session start = created_at - time, Session end = created_at
|
||||
* @returns {Promise<Array<{created_at: string, time: number}>>}
|
||||
*/
|
||||
async getCurrentUserOnlineSessions() {
|
||||
const data = [];
|
||||
await sqliteService.execute(
|
||||
(dbRow) => {
|
||||
data.push({ created_at: dbRow[0], time: dbRow[1] || 0 });
|
||||
},
|
||||
`SELECT created_at, time FROM gamelog_location ORDER BY created_at`
|
||||
);
|
||||
return data;
|
||||
},
|
||||
|
||||
async getUserIdFromDisplayName(displayName) {
|
||||
var userId = '';
|
||||
await sqliteService.execute(
|
||||
|
||||
Reference in New Issue
Block a user