SFII / scq

Our main repo for the SCQ senior project.
8 stars 6 forks source link

Feature/expanded survey results #153

Closed untra closed 8 years ago

untra commented 8 years ago

Added in a new endpoint: GET api/results/<survey_id>

This returns a formatted set of survey results, with embedded objects ready to be inserted into chartists bars and pies.

[  
   {  
      "bar_data":{  
         "series":[  
            [  
               0,
               0,
               1,
               1,
               0,
               1,
               1,
               1,
               0,
               0
            ]
         ],
         "labels":[  
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            10
         ]
      },
      "pie_data":[  

      ],
      "options":[  

      ],
      "title":"rating",
      "id":"3c5c245c-9d5e-48b0-b79d-5e69003ebe5e",
      "results":[  
         4,
         8,
         3,
         6,
         7
      ],
      "total_responses":5,
      "response_format":"rating"
   },
   {  
      "bar_data":{  
         "series":[  
            0
         ],
         "labels":[  
            "alpha",
            "delta",
            "gamma"
         ]
      },
      "pie_data":[  
         {  
            "value":2,
            "name":"alpha"
         },
         {  
            "value":1,
            "name":"delta"
         },
         {  
            "value":2,
            "name":"gamma"
         }
      ],
      "options":[  
         "alpha",
         "beta",
         "gamma",
         "delta"
      ],
      "title":"multiple choice",
      "id":"60b534dc-77f5-4964-b2b5-1fd0f69b53f0",
      "results":[  
         "alpha",
         "gamma",
         "alpha",
         "gamma",
         "delta"
      ],
      "total_responses":5,
      "response_format":"multipleChoice"
   },
   {  
      "bar_data":[  

      ],
      "pie_data":[  

      ],
      "options":[  

      ],
      "title":"free response",
      "id":"81f3f49a-0fe7-4571-884c-056f488614e0",
      "results":[  
         "sed existimo te, sicut nostrum Triarium, minus ab eo delectari, quod ista Platonis, Aristoteli, Theophrasti orationis ornamenta neglexerit.",
         "Non eram nescius, Brute, cum, quae summis ingeniis exquisitaque doctrina philosophi Graeco sermone tractavissent, ea Latinis litteris mandaremus, fore ut hic noster labor in varias reprehensiones incurreret.",
         "quis enim tam inimicus paene nomini Romano est, qui Ennii Medeam aut Antiopam Pacuvii spernat aut reiciat, quod se isdem Euripidis fabulis delectari dicat, Latinas litteras oderit?",
         "Scaevolam M.que Manilium, ab iisque M.",
         "Ego autem quem timeam lectorem, cum ad te ne Graecis quidem cedentem in philosophia audeam scribere? quamquam a te ipso id quidem facio provocatus gratissimo mihi libro, quem ad me de virtute misisti."
      ],
      "total_responses":5,
      "response_format":"freeResponse"
   },
   {  
      "bar_data":[  

      ],
      "pie_data":[  
         {  
            "value":5,
            "name":"false"
         }
      ],
      "options":[  
         true,
         false
      ],
      "title":"true or false",
      "id":"ba692758-148c-4339-b26b-6d9653eb20ac",
      "results":[  
         false,
         false,
         false,
         false,
         false
      ],
      "total_responses":5,
      "response_format":"trueOrFalse"
   }
]
untra commented 8 years ago

@MCChung303 this should be pulled in as soon as possble so you can get to work on making the graphs and visualizations for the frontend.