'Method to group the answers by the categories passed in
The categories will belong to another question.
For example the categories might be an option question which has
responses from High, Medium and Low. So all the responses that
correspond to the High category will go into one group, the Medium
into a second group and Low into the final group.
Later these may go through a filter which could calculate the
sum, or maybe the mean. Finally the result will be split.
See controllers/survey.py - series_graph()
@todo: parameter description'

def groupData(self, groupAnswer):

    grouped = {}
    answers = {}
    for answer in self.answerList:
        answers[answer['complete_id']] = answer['value']
    for ganswer in groupAnswer:
        gcode = ganswer['complete_id']
        greply = ganswer['value']
        if (gcode in answers):
            value = answers[gcode]
            if (greply in grouped):
                grouped[greply].append(value)
            else:
                grouped[greply] = [value]
        elif (greply not in grouped):
            grouped[greply] = []
    return grouped
