mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-04 05:46:07 +02:00
fix: Update getLastGroupVisit to use groupId and adjust query accordingly
This commit is contained in:
@@ -18,14 +18,17 @@ import { useNotificationStore } from '../stores/notification';
|
|||||||
import { useUiStore } from '../stores/ui';
|
import { useUiStore } from '../stores/ui';
|
||||||
import { useUserStore } from '../stores/user';
|
import { useUserStore } from '../stores/user';
|
||||||
import { useGroupStore } from '../stores/group';
|
import { useGroupStore } from '../stores/group';
|
||||||
import { syncGroupSearchIndex, removeGroupSearchIndex, clearGroupSearchIndex } from './searchIndexCoordinator';
|
import {
|
||||||
|
syncGroupSearchIndex,
|
||||||
|
removeGroupSearchIndex,
|
||||||
|
clearGroupSearchIndex
|
||||||
|
} from './searchIndexCoordinator';
|
||||||
import { watchState } from '../services/watchState';
|
import { watchState } from '../services/watchState';
|
||||||
|
|
||||||
import configRepository from '../services/config';
|
import configRepository from '../services/config';
|
||||||
|
|
||||||
import * as workerTimers from 'worker-timers';
|
import * as workerTimers from 'worker-timers';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ref
|
* @param ref
|
||||||
*/
|
*/
|
||||||
@@ -48,7 +51,6 @@ function applyGroupLanguage(ref) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {object} json
|
* @param {object} json
|
||||||
@@ -180,7 +182,6 @@ export function applyGroupMember(json) {
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param ref
|
* @param ref
|
||||||
@@ -275,7 +276,6 @@ function groupRoleChange(ref, oldRoles, newRoles, oldRoleIds, newRoleIds) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param groupId
|
* @param groupId
|
||||||
@@ -348,7 +348,7 @@ export function showGroupDialog(groupId, options = {}) {
|
|||||||
.then((args1) => {
|
.then((args1) => {
|
||||||
D.ownerDisplayName = args1.ref.displayName;
|
D.ownerDisplayName = args1.ref.displayName;
|
||||||
});
|
});
|
||||||
database.getLastGroupVisit(D.ref.name).then((r) => {
|
database.getLastGroupVisit(D.id).then((r) => {
|
||||||
if (D.id === ref.id) {
|
if (D.id === ref.id) {
|
||||||
D.lastVisit = r.created_at;
|
D.lastVisit = r.created_at;
|
||||||
}
|
}
|
||||||
@@ -461,7 +461,6 @@ export function getGroupDialogGroup(groupId, existingRef) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {object} ref
|
* @param {object} ref
|
||||||
@@ -507,7 +506,12 @@ export function onGroupJoined(groupId) {
|
|||||||
name: '',
|
name: '',
|
||||||
iconUrl: ''
|
iconUrl: ''
|
||||||
});
|
});
|
||||||
syncGroupSearchIndex({ id: groupId, name: '', ownerId: '', iconUrl: '' });
|
syncGroupSearchIndex({
|
||||||
|
id: groupId,
|
||||||
|
name: '',
|
||||||
|
ownerId: '',
|
||||||
|
iconUrl: ''
|
||||||
|
});
|
||||||
groupRequest.getGroup({ groupId, includeRoles: true }).then((args) => {
|
groupRequest.getGroup({ groupId, includeRoles: true }).then((args) => {
|
||||||
applyGroup(args.json);
|
applyGroup(args.json);
|
||||||
saveCurrentUserGroups();
|
saveCurrentUserGroups();
|
||||||
@@ -547,7 +551,6 @@ export async function onGroupLeft(groupId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -709,7 +712,6 @@ export async function updateInGameGroupOrder() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param groupId
|
* @param groupId
|
||||||
|
|||||||
@@ -307,21 +307,19 @@ const gameLog = {
|
|||||||
return ref;
|
return ref;
|
||||||
},
|
},
|
||||||
|
|
||||||
async getLastGroupVisit(groupName) {
|
async getLastGroupVisit(groupId) {
|
||||||
var ref = {
|
var ref = {
|
||||||
created_at: '',
|
created_at: ''
|
||||||
groupName: ''
|
|
||||||
};
|
};
|
||||||
await sqliteService.execute(
|
await sqliteService.execute(
|
||||||
(row) => {
|
(row) => {
|
||||||
ref = {
|
ref = {
|
||||||
created_at: row[0],
|
created_at: row[0]
|
||||||
groupName: row[1]
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
`SELECT created_at, group_name FROM gamelog_location WHERE group_name = @groupName ORDER BY id DESC LIMIT 1`,
|
`SELECT created_at FROM gamelog_location WHERE location LIKE @groupId ORDER BY id DESC LIMIT 1`,
|
||||||
{
|
{
|
||||||
'@groupName': groupName
|
'@groupId': `%${groupId}%`
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return ref;
|
return ref;
|
||||||
@@ -1461,11 +1459,18 @@ const gameLog = {
|
|||||||
* @param {string} [excludeWorldId=''] - Optional world ID to exclude from results.
|
* @param {string} [excludeWorldId=''] - Optional world ID to exclude from results.
|
||||||
* @returns {Promise<Array<{worldId: string, worldName: string, visitCount: number, totalTime: number}>>}
|
* @returns {Promise<Array<{worldId: string, worldName: string, visitCount: number, totalTime: number}>>}
|
||||||
*/
|
*/
|
||||||
async getMyTopWorlds(days = 0, limit = 5, sortBy = 'time', excludeWorldId = '') {
|
async getMyTopWorlds(
|
||||||
|
days = 0,
|
||||||
|
limit = 5,
|
||||||
|
sortBy = 'time',
|
||||||
|
excludeWorldId = ''
|
||||||
|
) {
|
||||||
const results = [];
|
const results = [];
|
||||||
const whereClause =
|
const whereClause =
|
||||||
days > 0 ? `AND created_at >= datetime('now', @daysOffset)` : '';
|
days > 0 ? `AND created_at >= datetime('now', @daysOffset)` : '';
|
||||||
const excludeClause = excludeWorldId ? 'AND world_id != @excludeWorldId' : '';
|
const excludeClause = excludeWorldId
|
||||||
|
? 'AND world_id != @excludeWorldId'
|
||||||
|
: '';
|
||||||
const orderBy =
|
const orderBy =
|
||||||
sortBy === 'count' ? 'visit_count DESC' : 'total_time DESC';
|
sortBy === 'count' ? 'visit_count DESC' : 'total_time DESC';
|
||||||
const params = { '@limit': limit };
|
const params = { '@limit': limit };
|
||||||
|
|||||||
Reference in New Issue
Block a user