import{aC as I}from"./app-k0jcl5PQ.js";import{I as f}from"./CG1PE8VW.chunk.js";import{I as C,a as d}from"./CNtKSILN.chunk.js";import{g as y,a as p,b as k,f as M}from"./CX9BGBTP.chunk.js";function v(c,o,r){const t={markingRequired:[],lowScore:[],highScore:[],completed:[],notCompleted:[]},n=y(c),m=new Set(n.map(e=>e.id));o.students.forEach(e=>{const s={...e,summary:h(c,e)};if(s.summary.awaitingMarking){t.markingRequired.push(s);return}if(I.last(e.results).attempts.filter(l=>{var w;return!!m.has((w=l==null?void 0:l.answers[0])==null?void 0:w.questionId)}).length===m.size)t.completed.push(s);else{t.notCompleted.push(s);return}s.summary.percentCorrect>=(r==null?void 0:r.HIGH)&&t.highScore.push(s),s.summary.percentCorrect<(r==null?void 0:r.MODERATE)&&t.lowScore.push(s)});const g=I.sortBy(t.lowScore,e=>e.summary.percentCorrect),a=I.sortBy(t.highScore,e=>-e.summary.percentCorrect);return{...t,lowScore:g,highScore:a}}function B(c,o){return M(c).find(t=>t.id.toString()===o.toString())}function S(c){return`${c.questionId}:${c.resultId}`}function b(c,o,r){const t=p(o),n=k(c,t);if(n==null?void 0:n.answers.every(a=>{var e;return((e=r[S(a)])==null?void 0:e.status)===d.Correct}))return d.Correct;if(n==null?void 0:n.answers.every(a=>{var e;return((e=r[S(a)])==null?void 0:e.status)===d.Incorrect}))return d.Incorrect}function R(c,o){const r=o.students.length;let t=0,n=0,m=0,g=0,a=0;return o.students.forEach(s=>{const i=p(s);if(!i)return;a=a+s.results.length;const u=C.isInteractionCorrect(c,i);u===f.Correct&&t++,u===f.UnAnswered&&m++,u===f.AwaitingMarking&&g++,u!==f.UnAnswered&&n++}),{percentCorrect:r>0?t/r:0,correct:t,answered:n,unanswered:m,awaitingMarking:g,attempts:a}}function h(c,o){const r=p(o),t=y(c),n=t.length;let m=0,g=0;t.forEach(i=>{const u=C.isInteractionCorrect(i,r);u===f.Correct&&m++,u===f.AwaitingMarking&&g++});const a=n>0?m/n:0,e=new Set(t.map(i=>i.id)),s=r.attempts.filter(i=>{var u;return!!e.has((u=i==null?void 0:i.answers[0])==null?void 0:u.questionId)}).length;return{answered:s,attempts:o.results.length,unanswered:n-s,percentCorrect:a,correct:m,awaitingMarking:g}}export{R as a,b,B as c,S as d,h as e,v as g};
//# sourceMappingURL=Bcve7ust.chunk.js.map
