def po_event_feedback_list(event_id): ids = rank_po_id_list(event_id, CID_EVENT_FEEDBACK, 'confidence') li = Po.mc_get_list(ids) Zsite.mc_bind(li, 'user', 'user_id') return li
def po_user_id_list(question_id): question = Po.mc_get(question_id) user_id = question.user_id po_id_list = rank_po_id_list(question_id, CID_QUESTION, 'confidence') po_list = Po.mc_get_list(po_id_list) user_id_list = [i.user_id for i in po_list] user_id_list.append(user_id) return set(user_id_list)
def po_answer_list(question_id, zsite_id=0, user_id=0): ids = rank_po_id_list(question_id, CID_QUESTION, 'confidence') if zsite_id == user_id: zsite_id = 0 user_ids = filter(bool, (zsite_id, user_id)) if user_ids: _ids = [] for i in user_ids: user_answer_id = answer_id_get(i, question_id) if user_answer_id: _ids.append(user_answer_id) if user_answer_id in ids: ids.remove(user_answer_id) if _ids: _ids.extend(ids) ids = _ids li = Po.mc_get_list(ids) Zsite.mc_bind(li, 'user', 'user_id') return li