def get_page(id,count): page,answer = ExamConditionService.get_page(id,current_user.user_id,count) page = json.loads(page) page['now_time'] = int(time.time()) page_dict = {'page':page,'answer':answer} page_json = json.dumps(page_dict) return page_json
def get_page_result(id,count): page,answer = ExamConditionService.get_page(id,current_user.user_id,count) page = json.loads(page) true_answer = {} for item in page['choice']+page['blank']+page['short_answer']: pid = item['pid'] true_answer[pid]=ProLibService.get_problem_detailed_info(item['pid']).answer page['now_time'] = int(time.time()) page_dict = {'page':page,'answer':answer,'true_answer':true_answer} print true_answer page_json = json.dumps(page_dict) return page_json