-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #249 from kobotoolbox/248-support-dymanic-select-o…
…ne-choice-list Support choice from previous repeat answers for `select_one`
- Loading branch information
Showing
4 changed files
with
162 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
tests/fixtures/select_one_from_previous_answers/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# coding: utf-8 | ||
|
||
from __future__ import (unicode_literals, print_function, | ||
absolute_import, division) | ||
|
||
''' | ||
select_one_from_previous_answers | ||
''' | ||
|
||
from ..load_fixture_json import load_fixture_json | ||
|
||
DATA = { | ||
'title': 'Household survey with select_one from previous answers', | ||
'id_string': 'select_one_from_previous_answers', | ||
'versions': [ | ||
load_fixture_json('select_one_from_previous_answers/v1'), | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
"version": "romev1", | ||
"content": { | ||
"survey": [ | ||
{ | ||
"name": "Q1", | ||
"type": "integer", | ||
"label": [ | ||
"How many members live in your family?" | ||
] | ||
}, | ||
{ | ||
"name": "FM", | ||
"type": "begin_repeat", | ||
"label": [ | ||
"Family Members" | ||
], | ||
"repeat_count": "${Q1}" | ||
}, | ||
{ | ||
"name": "Q2", | ||
"type": "text", | ||
"label": [ | ||
"Name?" | ||
] | ||
}, | ||
{ | ||
"name": "Q3", | ||
"type": "integer", | ||
"label": [ | ||
"${Q2}'s age?" | ||
] | ||
}, | ||
{ | ||
"type": "end_repeat" | ||
}, | ||
{ | ||
"name": "Q4", | ||
"type": "select_one", | ||
"label": [ | ||
"Select the head of the household." | ||
], | ||
"select_from_list_name": "${Q2}" | ||
}, | ||
{ | ||
"name": "Q5", | ||
"type": "select_one", | ||
"label": [ | ||
"Select the youngest child (<18 years) who is currently available in the family." | ||
], | ||
"choice_filter": "${Q3} < 18", | ||
"select_from_list_name": "${Q2}" | ||
} | ||
] | ||
}, | ||
"submissions": [ | ||
{ | ||
"FM": [ | ||
{ | ||
"FM/Q2": "Julius Caesar", | ||
"FM/Q3": "53" | ||
}, | ||
{ | ||
"FM/Q2": "Gaius Octavius", | ||
"FM/Q3": "17" | ||
} | ||
], | ||
"FM_count": "2", | ||
"Q1": "2", | ||
"Q4": "Julius Caesar", | ||
"Q5": "Gaius Octavius", | ||
"meta/versionID": "romev1", | ||
"meta/instanceID": "uuid:40805f86-2638-46f1-ab5a-72f4632474b5" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters