kmteras / polap

Web Application Development (LTAT.05.004)
1 stars 0 forks source link

Implement getStatsFromApiEndpointThatTerasHopefullyMakes(id) into js #49

Closed kmteras closed 6 years ago

kmteras commented 6 years ago

/api/sessions/statistics/{sessionCode} returns statistics for session in this format:

{
   "statistics":[
      {
         "question":"Question 1",
         "answers":[
            {
               "total":1,
               "answer":"Yes",
               "correct":true,
               "percentage":0,
               "id":33,
               "selected":0
            },
            {
               "total":1,
               "answer":"No",
               "correct":false,
               "percentage":100,
               "id":34,
               "selected":0
            }
         ],
         "id":23
      },
      {
         "question":"Question 2",
         "answers":[
            {
               "total":1,
               "answer":"Ans 1",
               "correct":false,
               "percentage":100,
               "id":35,
               "selected":0
            },
            {
               "total":1,
               "answer":"Ans 2",
               "correct":true,
               "percentage":100,
               "id":36,
               "selected":1
            },
            {
               "total":1,
               "answer":"Ans 3",
               "correct":true,
               "percentage":100,
               "id":37,
               "selected":1
            },
            {
               "total":1,
               "answer":"Ans 4",
               "correct":false,
               "percentage":100,
               "id":38,
               "selected":0
            }
         ],
         "id":24
      },
      {
         "question":"Question 3",
         "answers":[
            {
               "total":1,
               "answer":"Only",
               "correct":false,
               "percentage":100,
               "id":61,
               "selected":0
            }
         ],
         "id":41
      }
   ]
}