Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Make sure we don't use a ton of GET query params for Kinto
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelKohler committed Jan 9, 2019
1 parent eef26fa commit a2408fa
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions shared/db/collections/sentences-meta.js
Expand Up @@ -272,14 +272,11 @@ export default class SentencesMeta {

async getAlreadyExistingSubset(language, sentences) {
const idList = sentences.map(s => hash(s));
const collection = await this.getCollection(language);
const result = await collection.listRecords({
filters: {
in_id: idList,
},
});
const result = await this.getAll(language);
const existingIDs = result.map((existingSentence) => existingSentence.id);

return result.data;
const existingSubmittedSentencesIDs = idList.filter((id) => existingIDs.includes(id));
return result.filter((existingSentence) => existingSubmittedSentencesIDs.includes(existingSentence.id));
}

async getMySentences(language) {
Expand Down

0 comments on commit a2408fa

Please sign in to comment.