mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +00:00
refactor(api): Use forEach instead of a for loop
This commit is contained in:
parent
923b6c495e
commit
ed4039c08c
1 changed files with 4 additions and 5 deletions
|
|
@ -608,12 +608,11 @@ schema.methods._processCollectionQuest = async function processCollectionQuest (
|
|||
});
|
||||
|
||||
// Add 0 for all items not found
|
||||
let questItems = Object.keys(this.quest.progress.collect);
|
||||
for (let i = 0; i < questItems.length; i++) {
|
||||
if (!itemsFound[questItems[i]]) {
|
||||
itemsFound[questItems[i]] = 0;
|
||||
Object.keys(this.quest.progress.collect).forEach((item) => {
|
||||
if (!itemsFound[item]) {
|
||||
itemsFound[item] = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let foundText = _.reduce(itemsFound, (m, v, k) => {
|
||||
m.push(`${v} ${quest.collect[k].text('en')}`);
|
||||
|
|
|
|||
Loading…
Reference in a new issue