Unable to generate problem report csv

Hi, I am able to generate problem reports before the attempt but unable to generate after the attempt.

edx version : lilac

lms worker logs

lms-worker_1     | 2021-07-07 08:28:49,297 ERROR 128 [celery.app.trace] [user None] [ip None] trace.py:255 - Task lms.djangoapps.instructor_task.tasks.calculate_problem_responses_csv.v2[ab8a0532-f086-4c26-aa55-b01417330540] raised unexpected: AssertionError()
lms-worker_1     | Traceback (most recent call last):
lms-worker_1     |   File "/openedx/venv/lib/python3.8/site-packages/celery/app/trace.py", line 412, in trace_task
lms-worker_1     |     R = retval = fun(*args, **kwargs)
lms-worker_1     |   File "/openedx/venv/lib/python3.8/site-packages/celery/app/trace.py", line 704, in __protected_call__
lms-worker_1     |     return self.run(*args, **kwargs)
lms-worker_1     |   File "/openedx/venv/lib/python3.8/site-packages/edx_django_utils/monitoring/internal/code_owner/utils.py", line 179, in new_function
lms-worker_1     |     return wrapped_function(*args, **kwargs)
lms-worker_1     |   File "/openedx/edx-platform/lms/djangoapps/instructor_task/tasks.py", line 180, in calculate_problem_responses_csv
lms-worker_1     |     return run_main_task(entry_id, task_fn, action_name)
lms-worker_1     |   File "/openedx/edx-platform/lms/djangoapps/instructor_task/tasks_helper/runner.py", line 120, in run_main_task
lms-worker_1     |     task_progress = task_fcn(entry_id, course_id, task_input, action_name)
lms-worker_1     |   File "/openedx/edx-platform/lms/djangoapps/instructor_task/tasks_helper/grades.py", line 995, in generate
lms-worker_1     |     student_data, student_data_keys = cls._build_student_data(
lms-worker_1     |   File "/openedx/edx-platform/lms/djangoapps/instructor_task/tasks_helper/grades.py", line 922, in _build_student_data
lms-worker_1     |     for username, state in block.generate_report_data(user_state_iterator, max_count):
lms-worker_1     |   File "/openedx/edx-platform/common/lib/xmodule/xmodule/capa_module.py", line 485, in generate_report_data
lms-worker_1     |     answer_text = lcp.find_answer_text(answer_id, current_answer=orig_answers)
lms-worker_1     |   File "/openedx/edx-platform/common/lib/capa/capa/capa_problem.py", line 672, in find_answer_text
lms-worker_1     |     assert len(elems) == 1
lms-worker_1     | AssertionError

I am also getting the same error. What I have found is that the report works OK in lilac until I have a choice problem that has been answered, in which case I get the above error. I haven’t tested any other problem types.

To reproduce I create a course from scratch with a single choice problem in it and then submit an answer and then run the student responses report, then I get the above error.

The reason that this report is broken appears to be because of this PR #27271 by @dave . minimal_init=True was added to the constructor arguments for LoncapaProblem in order to make it run more efficiently - but some preprocessing of the inputs is then not done in LoncapaProblem.__init__ which results in the above exception when attempting to look up the human readable answer.

The easy fix is to revert back to minimal_init=False , but not sure what that will mean for @dave 's requirement

My apologies. :frowning: I had to revert that one five days later, so I think it’s just cherry-picking the revert into lilac.

Revert PR to open-release/lilac.master:

Ok, thanks @dave! I will take it out too.