Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Surveys

Entity: survey.survey

Compute Method: _compute_session_answer_count

Inputs Method Outputs
""" We have to loop since our result is dependent of the survey.session_start_time.
        This field is currently used to display the count about a single survey, in the
        context of sessions, so it should not matter too much. """
for survey in self:
            [answer_count] = self.env['survey.user_input']._read_group(
                [('survey_id', '=', survey.id),
                 ('is_session_answer', '=', True),
                 ('state', '!=', 'done'),
                 ('create_date', '>=', survey.session_start_time)],
                aggregates=['create_uid:count'],
            )[0]
            survey.session_answer_count = answer_count

Back to entity