'Display survey Results & Statistics for given survey.'

@http.route(['/survey/results/<model("survey.survey"):survey>'], type='http', auth='user', website=True)
def survey_reporting(self, survey, token=None, **post):

    result_template = 'survey.result'
    current_filters = []
    filter_display_data = []
    filter_finish = False
    if ((not survey.user_input_ids) or (not [input_id.id for input_id in survey.user_input_ids if (input_id.state != 'new')])):
        result_template = 'survey.no_result'
    if ('finished' in post):
        post.pop('finished')
        filter_finish = True
    if (post or filter_finish):
        filter_data = self.get_filter_data(post)
        current_filters = survey.filter_input_ids(filter_data, filter_finish)
        filter_display_data = survey.get_filter_display_data(filter_data)
    return request.render(result_template, {'survey': survey, 'survey_dict': self.prepare_result_dict(survey, current_filters), 'page_range': self.page_range, 'current_filters': current_filters, 'filter_display_data': filter_display_data, 'filter_finish': filter_finish})
