diff --git a/comm/server/main.py b/comm/server/main.py index f7e6ee2c2a7f0820ad7704a8c2f88f237941226d..24f267db70d6bdbeaf82d67e7bbc3e847e4a9ade 100644 --- a/comm/server/main.py +++ b/comm/server/main.py @@ -117,9 +117,8 @@ def update_answer_list(qname): if answer_log['solved'] == "True": is_solved = True - - if questions[qname]['answer'] == answer_log['answer']: - questions[qname]['best_json'] = json_name + if questions[qname]['answer'] == answer_log['answer']: + questions[qname]['best_json'] = json_name if (questions[qname]['last_req'] == float(answer_log['req_id'])): if answer_log['solver'] in questions[qname]['solver']: @@ -348,8 +347,12 @@ def save_best_solution(): _best_json = "" for k, v in questions[qname]['answers'].items(): - if v['nlcheck'] > _best_score: - _best_socer = v['nlcheck'] + try: + _score = float(v['nlcheck']) + except: + _score = -1 + if _score > _best_score: + _best_score = _score _best_json = k if _best_json != "": @@ -357,6 +360,8 @@ def save_best_solution(): if not os.path.isdir(out_path): os.makedirs(out_path) + print("Saved answer for {}: {}".format(qname, _best_json)) + qnumber = qname.replace("NL_Q", "").replace(".txt", "") out_file_path = "{}/T01_A{}.txt".format(out_path, qnumber) with open(out_file_path, 'w') as fp: