"""
- for mat_col in matrix_ans:
- rml+="""| """ + to_xml(tools.ustr(mat_col)) + """ | """
+ for mat_col in range(0,len(matrix_ans)):
+ rml+="""""" + to_xml(tools.ustr(matrix_ans[mat_col][1])) + """ | """
rml+="""Rating Average |
Response Count |
"""
@@ -250,21 +250,23 @@ class survey_analysis(report_rml):
rating_weight_sum = 0
for mat_col in range(1, len(matrix_ans)):
cr.execute("select count(sra.answer_id) from survey_response_line sr, survey_response_answer sra\
- where sr.id = sra.response_id and sra.answer_id = %d and sra.answer ='%s'" % (ans.id,matrix_ans[mat_col]))
+ where sr.id = sra.response_id and sra.answer_id = %d and sra.column_id ='%d'" % (ans.id,matrix_ans[mat_col][0]))
tot_res = cr.fetchone()[0]
cr.execute("select count(sra.answer_id),sqc.rating_weight from survey_response_line sr, survey_response_answer sra ,\
survey_question_column_heading sqc where sr.id = sra.response_id and \
sqc.question_id = sr.question_id and sra.answer_id = %d and sqc.title ='%s'\
- group by sra.answer_id,sqc.rating_weight" % (ans.id,matrix_ans[mat_col]))
+ group by sra.answer_id,sqc.rating_weight" % (ans.id,matrix_ans[mat_col][1]))
col_weight = cr.fetchone()
- if not col_weight :
+ if not col_weight:
col_weight= (0,0)
+ elif not col_weight[1]:
+ col_weight = (col_weight[0],0)
res_count = col_weight[0]
- if tot_res:
- rating_weight_sum += col_weight[1] * tot_res
+ if tot_res and res_count:
+ rating_weight_sum += int(col_weight[1]) * tot_res
tot_per = round((float(tot_res) * 100) / int(res_count), 2)
else:
- tot_res = 0
+ tor_res = 0
tot_per = 0.0
if tot_res:
rml += """""" + tools.ustr(tot_per) + "%(" + tools.ustr(tot_res) + """) | """
@@ -292,10 +294,10 @@ class survey_analysis(report_rml):
rml += """""" + to_xml(tools.ustr(menu)) + """ | """
rml += """Response Count |