Problem/Motivation

Currently it is impossible to export question answer data. A single result can be viewed, along with a per-question result, but it is not possible to see the user's answers because the answer format is stored differently across all the question types.

This could be done easily by using a custom Views field that loads the answer, however doing this on a large scale (100+ questions, 1000+ results) becomes infeasible.

Doing it in a custom report would work, however we would have to make logic trees and include all question types. We also lose the functionality in views to do things like add profile fields, Quiz fields, etc.

Additionally having dynamic columns in Views is not possible out of the box, to render a CSV like:

Result ID User ID 1. Is the sky blue? 2. What is hot?
2 3 True Sun
Stove

Proposed resolution

Build a custom views handler that creates dynamic columns on a view, so that we can have one column per question in the Quiz. Provide a default, non-scalable default implementation, and warn other question types that they should implement a scalable one.

Remaining tasks

- Remove unused legacy Quiz views handlers
- Make wildcard field handler
- Add API method for Question answer helper
- Add tests

User interface changes

- Quiz result now has a CSV export using views_data_export (optional)

API changes

- viewsGetAnswers() added to QuizQuestionResponse
- views_data_export now required to export answer data

Data model changes

- None

Comments

djdevin’s picture

Issue summary: View changes
Issue tags: +Needs tests
StatusFileSize
new40.29 KB
djdevin’s picture

Issue summary: View changes
djdevin’s picture

Issue summary: View changes
djdevin’s picture

Issue summary: View changes
StatusFileSize
new43.19 KB

  • djdevin committed ae5079c on
    Issue #2521904 by djdevin: Export results with answers
    
djdevin’s picture

Issue summary: View changes
djdevin’s picture

Status: Needs review » Fixed
Issue tags: -Needs tests

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.