Add batching to wrapped
This commit is contained in:
parent
791d4dd33a
commit
79475dce7f
@ -1,6 +1,6 @@
|
|||||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||||
const { getUserRegistration, getBeatenGames, checkGameStorageId, getChangelog, getLeaderboardEntriesBetweenDates, getLeaderboardEntries, getBeatenGamesForYear } = require('../../databaseHelperFunctions');
|
const { getUserRegistration, getBeatenGames, checkGameStorageId, getChangelog, getLeaderboardEntriesBetweenDates, getLeaderboardEntries, getBeatenGamesForYear } = require('../../databaseHelperFunctions');
|
||||||
const { getGameJson, getGenres, getCompanyInfo } = require('../../igdbHelperFunctions');
|
const { getGameJson, getGenres, getInvolvedCompanies, getCompanies } = require('../../igdbHelperFunctions');
|
||||||
|
|
||||||
let userBeatenGamesDatabaseEntries = {};
|
let userBeatenGamesDatabaseEntries = {};
|
||||||
let beatGameIGDBEntries = [];
|
let beatGameIGDBEntries = [];
|
||||||
@ -114,29 +114,30 @@ async function GetIGDBEntries(array) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function GetDevelopers() {
|
async function GetDevelopers() {
|
||||||
companies = [];
|
const involvedCompanyIds = new Set();
|
||||||
const companyIds = new Set();
|
|
||||||
|
|
||||||
for (let i = 0; i < beatGameIGDBEntries.length; i++) {
|
for (let i = 0; i < beatGameIGDBEntries.length; i++) {
|
||||||
if (beatGameIGDBEntries[i].involved_companies)
|
if (beatGameIGDBEntries[i].involved_companies)
|
||||||
{
|
{
|
||||||
for (let j = 0; j < beatGameIGDBEntries[i].involved_companies.length; j++) {
|
for (let j = 0; j < beatGameIGDBEntries[i].involved_companies.length; j++) {
|
||||||
companyIds.add(beatGameIGDBEntries[i].involved_companies[j]);
|
involvedCompanyIds.add(beatGameIGDBEntries[i].involved_companies[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ids = [...companyIds];
|
const involvedIds = [...involvedCompanyIds];
|
||||||
const tempIds = [];
|
|
||||||
|
|
||||||
for (let i = 0; i < ids.length; i++) {
|
const involvedCompanies = await getInvolvedCompanies(involvedIds);
|
||||||
const company = await getCompanyInfo(ids[i]);
|
const companyIds = new Set();
|
||||||
|
for (let i = 0; i < involvedCompanies.length; i++) {
|
||||||
if (!tempIds.includes(company.id)) {
|
if (involvedCompanies[i].company)
|
||||||
tempIds.push(company.id);
|
{
|
||||||
companies.push(company);
|
companyIds.add(involvedCompanies[i].company);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const compIds = [...companyIds];
|
||||||
|
companies = await getCompanies(compIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function GetNumberOfGamesBeat() {
|
async function GetNumberOfGamesBeat() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user