Algorithm: Calculate Quiz Results for a Company
api => @Get  : /api/quiz

{
  "companyId": "your_company_id_here",
  "resultType": "quiz_market",  // or "current_sector"
  "questionCodes": ["q1", "q2", "q3", "q4", "q5"],
  "round": "round_number_here"
}

 
 
***************
Logic in nestJs: Calculated results for each questionCode in the quiz (json example output)

algorithm:
 *Validate Quiz Completion : fetch from "company_quiz" table using companyId and quizCode.
                           If quiz_status is not "COMPLETED"
						   Then return an message('please make sure  that quiz has already completed').
						   
*Calculate the Result
calcul:
Fetch Company Quiz Responses :
		*Retrieve all responses from the "company_quiz_response" table where
		(companyId  and quizCode).
		*Retrieve all responses for all comapanies exist
Process Each Question :
logic of calcul 
 *For each unique questionCode in the retrieved responses:
			*fetch Total Items =>GET from "solution_quiz_section_questions_items" 
			the complete list of itemCode associated with the current questionCode.
 *Return for each quizCode { list of itemCode with values grouped by questionCode).

 question : for  the type of question (Bar, table,pie)is that have an impact for values of results ? 