def get_answers(raw_question_list): question_list = [] for question in raw_question_list: name = common.get_value(question['input']['value']) question_list.append((name, question['label'], question['input']['id'])) return question_list
def get_answer_row(field, total): # Multiple select fields use the same field name to send # different values. Unfortunately lime survey doesn't support # this type of format. Checkboxes fields are represented as a # list of fields with different names and a `Y` value is sent # when the field is checked. # Since the `id` and `value` field name are the same a # workaround is to send a special `value` that will be reversed # as the field ID to extract the original `name` and the value # can be attached . e.g # value='6251626' compressed to `v1626` # `v1626` references field ID `6251626` and the field contains # `name` and `value` to be sent back. row_value = common.get_value(field['input']['value']) partial_row = [ 'SQ', 0, row_value, '', field['label'], '', 'en', '', '', '', ] full_row = partial_row + common.get_missing(partial_row, total) metadata = { 'field_id': field['input'].get('id'), } full_row.append(metadata) return full_row
def get_answer_row(field, total): row_value = common.get_value(field['input']['value']) partial_row = [ 'A', 0, row_value, '', field['label'], '', 'en', '', '', '', ] full_row = partial_row + common.get_missing(partial_row, total) # Add row metadata: metadata = { 'field_id': field['input'].get('id'), } full_row.append(metadata) return full_row