def buildCompletedList(series_id, question_id_list):
 db = current.db
 qtable = current.s3db.survey_question
 headers = []
 happend = headers.append
 types = []
 items = []
 qstn_posn = 0
 row_len = len(question_id_list)
 complete_lookup = {}
 for question_id in question_id_list:
  answers = survey_getAllAnswersForQuestionInSeries(question_id, series_id)
  widget_obj = survey_getWidgetFromQuestion(question_id)
  question = db((qtable.id == question_id)).select(qtable.name, limitby=(0, 1)).first()
  happend(question.name)
  types.append(widget_obj.db_type())
  for answer in answers:
   complete_id = answer['complete_id']
   if (complete_id in complete_lookup):
    row = complete_lookup[complete_id]
   else:
    row = len(complete_lookup)
    complete_lookup[complete_id] = row
    items.append(([''] * row_len))
   items[row][qstn_posn] = widget_obj.repr(answer['value'])
  qstn_posn += 1
 return (([headers] + [types]) + items)

def buildCompletedList ( series_id , question_id_list ) : db = current . db qtable = current . s3db . survey_question headers = [ ] happend = headers . append types = [ ] items = [ ] qstn_posn = 0 row_len = len ( question_id_list ) complete_lookup = { } for question_id in question_id_list : answers = survey_getAllAnswersForQuestionInSeries ( question_id , series_id ) widget_obj = survey_getWidgetFromQuestion ( question_id ) question = db ( ( qtable . id == question_id ) ) . select ( qtable . name , limitby = ( 0 , 1 ) ) . first ( ) happend ( question . name ) types . append ( widget_obj . db_type ( ) ) for answer in answers : complete_id = answer [ 'complete_id' ] if ( complete_id in complete_lookup ) : row = complete_lookup [ complete_id ] else : row = len ( complete_lookup ) complete_lookup [ complete_id ] = row items . append ( ( [ '' ] * row_len ) ) items [ row ] [ qstn_posn ] = widget_obj . repr ( answer [ 'value' ] ) qstn_posn += 1 return ( ( [ headers ] + [ types ] ) + items )
build a list of completed items for the series including just the questions in the list passed in the list will come in three parts .