Algorithm: Calculate Quiz Results for a Company Input:(companyId ,quizCode) Api: GET /questionnaire/:quizCode/company/:companyId/echarts Output: 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 ). example output .json { "quizCode": "Salary_Revision_Quiz", "companyId": "1", "results": [ { "questionCode": "Q2-PRS-1", "items": [ { "itemCode": "yes", "value": 40 }, { "itemCode": "no", "value": 60 } ] }, { "questionCode": "Q2-PRS-2", "items": [ { "itemCode": "less-than-1-year", "value": 20 }, { "itemCode": "1-3-years", "value": 30 }, { "itemCode": "3-5-years", "value": 25 }, { "itemCode": "more-than-5-years", "value": 25 } ] }, { "questionCode": "Q2-PRS-3", "items": [ { "itemCode": "annually", "value": 35 }, { "itemCode": "semi-annually", "value": 35 }, { "itemCode": "quarterly", "value": 20 }, { "itemCode": "other-please-specify", "value": 10 } ] }, { "questionCode": "Q2-PRS-4", "items": [ { "itemCode": "employee-motivation-retention", "value": 45 }, { "itemCode": "alignment-of-wages", "value": 20 }, { "itemCode": "reward-for-performance", "value": 15 }, { "itemCode": "internal-equity", "value": 10 }, { "itemCode": "other-please-specify", "value": 10 } ] }, { "questionCode": "Q2-PRS-5", "items": [ { "itemCode": "individual-performance", "value": 25 }, { "itemCode": "team-performance", "value": 25 }, { "itemCode": "company-performance", "value": 20 }, { "itemCode": "seniority", "value": 15 }, { "itemCode": "specific-skills", "value": 5 }, { "itemCode": "market-salary-comparison", "value": 5 }, { "itemCode": "achieving-personal-goals", "value": 3 }, { "itemCode": "other-please-specify", "value": 2 } ] }, { "questionCode": "Q2-PRS-6", "items": [ { "itemCode": "merit-increases", "value": 30 }, { "itemCode": "cost-of-living-adjustments", "value": 25 }, { "itemCode": "promotion-increases", "value": 20 }, { "itemCode": "one-time-bonuses", "value": 15 }, { "itemCode": "market-comparisons", "value": 5 }, { "itemCode": "other-please-specify", "value": 5 } ] }, { "questionCode": "Q2-PRS-7", "items": [ { "itemCode": "less-than-3-percent", "value": 40 }, { "itemCode": "between-3-and-5-percent", "value": 30 }, { "itemCode": "between-5-and-7-percent", "value": 20 }, { "itemCode": "more-than-7-percent", "value": 10 } ] }, { "questionCode": "Q2-PRS-8", "items": [ { "itemCode": "less-than-3-percent", "value": 25 }, { "itemCode": "between-3-and-5-percent", "value": 35 }, { "itemCode": "between-5-and-7-percent", "value": 25 }, { "itemCode": "more-than-7-percent", "value": 15 } ] }, { "questionCode": "Q2-PRS-9", "items": [ { "itemCode": "less-than-1-percent", "value": 15 }, { "itemCode": "between-1-and-3-percent", "value": 35 }, { "itemCode": "between-3-and-5-percent", "value": 30 }, { "itemCode": "more-than-5-percent", "value": 20 } ] } ] } question : for the type of question (Bar, table,pie)is that have an impact for values of results ?