akvo / akvo-flow

A data collection and monitoring tool that works anywhere.
http://akvo.org/products/akvoflow/
GNU Affero General Public License v3.0
65 stars 31 forks source link

Add labels to option questions options #828

Closed mtwestra closed 8 years ago

mtwestra commented 10 years ago

The aim is to add a value to question options, in the same way as HTML options have a label and a value. The main purpose for this is to make it easier to import FLOW data into existing databases. The label would be used for display, the value will be used for in API's or optionally in data exports.

In many cases, existing databases use coding schemes to codify answers to questions. For example, 'yes' might be 1, and 'no' might be 0. Another example could be 'banana'=01, 'orange'=02, 'grapefruit'=03.

Implements https://github.com/akvo/akvo-product-design/issues/34

muloem commented 9 years ago

@mtwestra did you already push the code done so far for this one?

mtwestra commented 9 years ago

@muloem, no, not yet. In need to clean it up and merge it to the current develop. That will take about 0.5-1 day of work

jonase commented 8 years ago

(pre) Test Plan

This issue is not feature complete yet but we have added some initial support for Option codes in exports. There should be no user visible changes when exporting reports with option questions and if there are, it should be regarded as a regression.

rumca commented 8 years ago

@jonase is this for the 1.9.4 milestone?

jonase commented 8 years ago

@rumca Yes we pushed the report part of the codes for options to 1.9.4.

jonase commented 8 years ago

Test Plan

Test 1: Creating options with and without codes

  1. Create a survey with a number of combinations of option questions. Including non-mandatory questions. Also include a geo question for rendering on the maps tab
    • options with codes
    • options without codes
    • allow multiple and allow other.
  2. Save and edit these questions, delete options, edit the codes, edit the options and save.
  3. Reload FLOW and open the survey and ensure that all options are consistent and saved as expected

Test 2: Creating dependencies based on options with codes

  1. Create a number of questions that are dependent on the option questions created in test 1.
  2. Ensure that dependencies can be set up and saved as expected. Reload FLOW and reopen the surveys and check that the dependencies are still correctly setup

Test 3: Form responses from options with(out) codes

  1. Publish the survey and assign to a device.
  2. Respond to the survey a number of times
  3. Check the inspect data tab, monitoring tab and maps tab to see that the responses are rendered correctly

Test 4: Reporting with options codes

Option questions can be configured to Allow other?, Allow multiple?, and Use codes? (9 combinations in total).

@rumca test plan for options with codes

rumca commented 8 years ago

@muloem I think one of the above commits has borked the option codes & saving options in general. It was definitely working before, but now it appears when I add some options to an option question and then click save that they're all just discarded?

rumca commented 8 years ago

@jonase not sure if you've got any time to have a look at this, think it might be a small enough fix though. On the inspect data tab when you've submitted an other option we don't display anything:

screen shot 2016-01-05 at 11 47 52

jonase commented 8 years ago

@rumca Is the "other" option never shown? What happens when you have "allow multiple" enabled?

rumca commented 8 years ago

The "other" response is correctly downloaded in the raw data reports etc, so I'm guess it just isn't being displayed on this tab. In both cases where I've allowed "other" here, it's not being displayed (one question allows multiple and the other doesn't).

rumca commented 8 years ago

Same thing on the monitoring tab:

screen shot 2016-01-05 at 11 58 47

rumca commented 8 years ago

(I think) Everything works as intended now, haven't been able to break it in a noticeable fashion anyway :+1: