To apply for my dirty code(4)

3351 ワード

I fixed Main part to this code in this time
const rewardAggreate = [];

const uniqueIds = getUniqueIds(dummyData);

for(const x in uniqueIds) {
    const userId = uniqueIds[x];
    const result = aggregate(dummyData, userId);
    rewardAggreate.push(result);
}

const targets = rewardAggreate.filter(item => item.reward === 0 && item.tFailedCount >= 10);

const newObjs = targets.map(item => { return { userId: item.userId, amount: 300, reason: "event" }});

//console.log("getPrizes", getPrizes);