def one_click_evaluate(cookie): evaluate = jwxt.get_evaluate_list(cookie) if evaluate[0] is True: evaluate = json.loads(jwxt.format_to_json(evaluate[1])) else: return (False, 'fail to get course list!') courses = evaluate['body']['dataStores']['pj1Stroe']['rowSet']['primary'] for course in courses: course_id = course['resourceid'] try: question_type = course['khtxbh'] except: question_type = course['j'] questions = jwxt.get_question_list(cookie, question_type) question_list = [] if questions[0] is True: questions = json.loads(jwxt.format_to_json(questions[1])) questions = questions['body']['dataStores']['wjStroe']['rowSet'][ 'primary'] else: return (False, 'fail to get question list on course %s!' % course_id) for question in questions: question_id = question['resourceId'] if question is questions[-1]: question_list.append([question_id, None]) break options = jwxt.get_option_list(cookie, question['resourceId']) if options[0] is True: options = json.loads(jwxt.format_to_json(options[1])) else: return (False, 'fail to get option list on question %s!' % question_id) option_id = options['body']['dataStores']['qzStore']['rowSet'][ 'primary'][0]['resourceid'] question_list.append([question_id, option_id]) course_ooxx_code = jwxt.get_course_ooxx_code(cookie, \ course['jsbh'], course['kch'], course['khlx'], \ course['jxbh'], course['khtxbh'], course['pjlx']) if course_ooxx_code[0] is True: course_ooxx_code = json.loads( jwxt.format_to_json(course_ooxx_code[1])) course_ooxx_code = course_ooxx_code['body']['parameters']['bjid'] else: return (False, 'fail to get ooxx_code on course %s!' % course_id) result = jwxt.submit_evaluation(cookie, question_list, course_ooxx_code)
def one_click_evaluate(cookie): evaluate = jwxt.get_evaluate_list(cookie) if evaluate[0] is True: evaluate = json.loads(jwxt.format_to_json(evaluate[1])) else: return (False, 'fail to get course list!') courses = evaluate['body']['dataStores']['pj1Stroe']['rowSet']['primary'] for course in courses: course_id = course['resourceid'] try: question_type = course['khtxbh'] except: question_type = course['j'] questions = jwxt.get_question_list(cookie, question_type) question_list = [] if questions[0] is True: questions = json.loads(jwxt.format_to_json(questions[1])) questions = questions['body']['dataStores']['wjStroe']['rowSet']['primary'] else: return (False, 'fail to get question list on course %s!' % course_id) for question in questions: question_id = question['resourceId'] if question is questions[-1]: question_list.append([question_id, None]) break options = jwxt.get_option_list(cookie, question['resourceId']) if options[0] is True: options = json.loads(jwxt.format_to_json(options[1])) else: return (False, 'fail to get option list on question %s!' % question_id) option_id = options['body']['dataStores']['qzStore']['rowSet']['primary'][0]['resourceid'] question_list.append([question_id, option_id]) course_ooxx_code = jwxt.get_course_ooxx_code(cookie, \ course['jsbh'], course['kch'], course['khlx'], \ course['jxbh'], course['khtxbh'], course['pjlx']) if course_ooxx_code[0] is True: course_ooxx_code = json.loads(jwxt.format_to_json(course_ooxx_code[1])) course_ooxx_code = course_ooxx_code['body']['parameters']['bjid'] else: return (False, 'fail to get ooxx_code on course %s!' % course_id) result = jwxt.submit_evaluation(cookie, question_list, course_ooxx_code)
elif s >= 2.0: return 2.7 def add_score(jd, xf, score): jd += [ toronto(float(i["jd"])) for i in score["body"]["dataStores"]["kccjStore"]["rowSet"]["primary"] ] xf += [ float(i["xf"]) for i in score["body"]["dataStores"]["kccjStore"]["rowSet"]["primary"] ] if __name__ == "__main__": username = sys.argv[1] password = sys.argv[2] _, cookie = fakesysujwxt.login(username, password) jd = [] xf = [] year_start = 2011 for yy in range(2): for term in range(1, 4): year = "%d-%d" % (year_start + yy, year_start + yy + 1) raw_score = fakesysujwxt.get_score(cookie, username, year, term)[1] score = json.loads(fakesysujwxt.format_to_json(raw_score)) add_score(jd, xf, score) a = sum([i * j for i, j in zip(jd, xf)]) print a / sum(xf)
if s >= 3.5: return 4.0 elif s >= 3.0: return 3.7 elif s >= 2.7: return 3.3 elif s >= 2.3: return 3.0 elif s >= 2.0: return 2.7 def add_score(jd, xf, score): jd += [toronto(float(i["jd"])) for i in score["body"]["dataStores"]["kccjStore"]["rowSet"]["primary"]] xf += [float(i["xf"]) for i in score["body"]["dataStores"]["kccjStore"]["rowSet"]["primary"]] if __name__ == "__main__": username = sys.argv[1] password = sys.argv[2] _, cookie = fakesysujwxt.login(username, password) jd = [] xf = [] year_start = 2011 for yy in range(2): for term in range(1, 4): year = "%d-%d" % (year_start + yy, year_start + yy + 1) raw_score = fakesysujwxt.get_score(cookie, username, year, term)[1] score = json.loads(fakesysujwxt.format_to_json(raw_score)) add_score(jd, xf, score) a = sum([i * j for i, j in zip(jd, xf)]) print a / sum(xf)