Advertisement
KoctrX

Untitled

Aug 7th, 2024
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const arr = inteviewDetails.qualityQuestions.reduce((res, curr, index) => {
  2.     const key = res.find(r => r.key === curr?.qualityAttribute?.key)
  3.     const score = { ...curr, score: application?.assessments?.["2nd-interview"]?.[index] }
  4.     if (key) {
  5.         key.stack.push(score)
  6.     } else {
  7.         res.push({
  8.             key: curr?.qualityAttribute?.key,
  9.             stack: [score],
  10.             name: curr.qualityAttribute.name,
  11.         })
  12.     }
  13.     return res
  14. }, []).map(item => {
  15.     let seredne = (item?.stack || []).reduce((r, it) => r + parseFloat(it.score), 0) / (item?.stack || []).length;
  16.    
  17.     return { ...item, seredne };
  18. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement