|
|
""" We have to loop since our result is dependent of the survey.session_question_id and
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.line']._read_group(
[('question_id', '=', survey.session_question_id.id),
('survey_id', '=', survey.id),
('create_date', '>=', survey.session_start_time)],
aggregates=['user_input_id:count_distinct'],
)[0]
survey.session_question_answer_count = answer_count
|
|