MCPcopy Create free account
hub / github.com/code100x/daily-code / getScore

Function getScore

apps/web/components/mcq/MCQCard.tsx:40–49  ·  view source on GitHub ↗
(atempted: any)

Source from the content-addressed store, hash-verified

38 const handleSubmit = (score: number) => {
39 setIsSubmitted(!isSubmitted);
40 function getScore(atempted: any) {
41 let score = 0;
42 for (const key in atempted) {
43 if (atempted[key]) {
44 score++;
45 }
46 }
47 score = parseInt(((score / questions.length) * 100).toPrecision(3));
48 return score;
49 }
50 setScore(getScore(atempted));
51
52 console.log("in submit", score);

Callers 2

handleSubmitFunction · 0.85
submitQuizFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected