mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 06:46:04 +02:00
Fix auto updater toggle, load friendsList tab much faster
This commit is contained in:
Vendored
+1
-7
@@ -3,11 +3,5 @@
|
|||||||
"i18n-ally.keystyle": "nested",
|
"i18n-ally.keystyle": "nested",
|
||||||
"i18n-ally.sourceLanguage": "en",
|
"i18n-ally.sourceLanguage": "en",
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true
|
||||||
"[javascript]": {
|
|
||||||
"editor.defaultFormatter": "vscode.typescript-language-features"
|
|
||||||
},
|
|
||||||
"[jade]": {
|
|
||||||
"editor.defaultFormatter": "svipas.prettier-plus"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+62
-5
@@ -19363,17 +19363,74 @@ speechSynthesis.getVoices();
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var inCurrentWorld = false;
|
|
||||||
if (this.lastLocation.playerList.has(ctx.ref.displayName)) {
|
|
||||||
inCurrentWorld = true;
|
|
||||||
}
|
|
||||||
this.getUserStats(ctx.ref, inCurrentWorld);
|
|
||||||
ctx.ref.$friendNum = ctx.no;
|
ctx.ref.$friendNum = ctx.no;
|
||||||
results.push(ctx.ref);
|
results.push(ctx.ref);
|
||||||
}
|
}
|
||||||
|
this.getAllUserStats();
|
||||||
this.friendsListTable.data = results;
|
this.friendsListTable.data = results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$app.methods.getAllUserStats = function () {
|
||||||
|
var userIds = [];
|
||||||
|
var displayNames = [];
|
||||||
|
for (var ctx of this.friends.values()) {
|
||||||
|
userIds.push(ctx.id);
|
||||||
|
if (ctx.ref?.displayName) {
|
||||||
|
displayNames.push(ctx.ref.displayName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
database.getAllUserStats(userIds, displayNames).then((data) => {
|
||||||
|
var friendListMap = new Map();
|
||||||
|
for (var item of data) {
|
||||||
|
if (!item.userId) {
|
||||||
|
// find userId from previous data with matching displayName
|
||||||
|
for (var ref of data) {
|
||||||
|
if (
|
||||||
|
ref.displayName === item.displayName &&
|
||||||
|
ref.userId
|
||||||
|
) {
|
||||||
|
item.userId = ref.userId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if still no userId, find userId from friends list
|
||||||
|
if (!item.userId) {
|
||||||
|
for (var ref of this.friends.values()) {
|
||||||
|
if (
|
||||||
|
ref?.ref?.id &&
|
||||||
|
ref.ref.displayName === item.displayName
|
||||||
|
) {
|
||||||
|
item.userId = ref.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if still no userId, skip
|
||||||
|
if (!item.userId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var friend = friendListMap.get(item.userId);
|
||||||
|
if (!friend) {
|
||||||
|
friendListMap.set(item.userId, item);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
friend.timeSpent += item.timeSpent;
|
||||||
|
friend.joinCount += item.joinCount;
|
||||||
|
friend.displayName = item.displayName;
|
||||||
|
friendListMap.set(item.userId, friend);
|
||||||
|
}
|
||||||
|
for (var item of friendListMap.values()) {
|
||||||
|
var ref = this.friends.get(item.userId);
|
||||||
|
if (ref?.ref) {
|
||||||
|
ref.ref.$joinCount = item.joinCount;
|
||||||
|
ref.ref.$lastSeen = item.created_at;
|
||||||
|
ref.ref.$timeSpent = item.timeSpent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$app.methods.getUserStats = async function (ctx) {
|
$app.methods.getUserStats = async function (ctx) {
|
||||||
var ref = await database.getUserStats(ctx);
|
var ref = await database.getUserStats(ctx);
|
||||||
/* eslint-disable require-atomic-updates */
|
/* eslint-disable require-atomic-updates */
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ mixin simpleRadioGroup(nameTrKey, model, options, onChange="")
|
|||||||
br
|
br
|
||||||
el-radio-group(v-model=model @change=onChange size="mini")
|
el-radio-group(v-model=model @change=onChange size="mini")
|
||||||
each option in options
|
each option in options
|
||||||
el-radio-button(label="#{option.label}") {{ $t('#{option.translationKey}') }}
|
el-radio-button(label=option.label) {{ $t('#{option.translationKey}') }}
|
||||||
|
|
||||||
mixin settingsTab()
|
mixin settingsTab()
|
||||||
.x-container(v-show="$refs.menu && $refs.menu.activeIndex === 'settings'")
|
.x-container(v-show="$refs.menu && $refs.menu.activeIndex === 'settings'")
|
||||||
|
|||||||
@@ -1042,6 +1042,53 @@ class Database {
|
|||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getAllUserStats(userIds, displayNames) {
|
||||||
|
var data = [];
|
||||||
|
// this makes me most sad
|
||||||
|
var userIdsString = '';
|
||||||
|
for (var userId of userIds) {
|
||||||
|
userIdsString += `'${userId}', `;
|
||||||
|
}
|
||||||
|
userIdsString = userIdsString.slice(0, -2);
|
||||||
|
var displayNamesString = '';
|
||||||
|
for (var displayName of displayNames) {
|
||||||
|
displayNamesString += `'${displayName.replaceAll("'", "''")}', `;
|
||||||
|
}
|
||||||
|
displayNamesString = displayNamesString.slice(0, -2);
|
||||||
|
|
||||||
|
await sqliteService.execute(
|
||||||
|
(dbRow) => {
|
||||||
|
var row = {
|
||||||
|
created_at: dbRow[0],
|
||||||
|
userId: dbRow[1],
|
||||||
|
timeSpent: dbRow[2],
|
||||||
|
joinCount: dbRow[3],
|
||||||
|
displayName: dbRow[4]
|
||||||
|
};
|
||||||
|
data.push(row);
|
||||||
|
},
|
||||||
|
`SELECT
|
||||||
|
g.created_at,
|
||||||
|
g.user_id,
|
||||||
|
SUM(g.time) AS timeSpent,
|
||||||
|
COUNT(DISTINCT g.location) AS joinCount,
|
||||||
|
g.display_name,
|
||||||
|
MAX(g.id) AS max_id
|
||||||
|
FROM
|
||||||
|
gamelog_join_leave g
|
||||||
|
WHERE
|
||||||
|
g.user_id IN (${userIdsString})
|
||||||
|
OR g.display_name IN (${displayNamesString})
|
||||||
|
GROUP BY
|
||||||
|
g.user_id,
|
||||||
|
g.display_name
|
||||||
|
ORDER BY
|
||||||
|
g.user_id DESC
|
||||||
|
`
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
async lookupFeedDatabase(search, filters, vipList) {
|
async lookupFeedDatabase(search, filters, vipList) {
|
||||||
var search = search.replaceAll("'", "''");
|
var search = search.replaceAll("'", "''");
|
||||||
var vipQuery = '';
|
var vipQuery = '';
|
||||||
|
|||||||
Reference in New Issue
Block a user