diff --git a/cli.py b/cli.py index ddb18a6..9db87d7 100644 --- a/cli.py +++ b/cli.py @@ -71,4 +71,8 @@ if __name__ == "__main__": #print_o_classes(o_classes) #print_class_splits(runner_list, o_classes[0]) #print(otime.check_codes(runner_list[1])) - otime.gen_xml_result(runner_list, o_classes) + #otime.gen_xml_result(runner_list, o_classes) + + testco = [51,52,53,31,32,23,33,34,35,55,56] + testrunner = [31,32,33,34,35] + print(otime.contains(testrunner, testco)) diff --git a/otime.py b/otime.py index c04348f..f76d043 100644 --- a/otime.py +++ b/otime.py @@ -39,6 +39,8 @@ class runner: def rank(self, allrunners): c_ranked = rank_runners(allrunners, self.o_class) return c_ranked.index(self) + 1 + def res_splits(self): + pass class course: def __init__(self, name, codes): @@ -217,7 +219,9 @@ def gen_xml_result(runners, o_classes): name = ET.SubElement(t, 'Name') name.text = i.name # - for n in get_runners_in_class(runners, i): + runners_same_c = get_runners_in_class(runners, i) + runners_ranked = rank_runners(runners_same_c, i) + for n in runners_same_c: person_result = ET.SubElement(class_result, 'PersonResult') # person = ET.SubElement(person_result, 'Person') @@ -251,8 +255,11 @@ def gen_xml_result(runners, o_classes): finish_t.text = n.f_time.isoformat() time = ET.SubElement(result, 'Time') time.text = str(n.totaltime()) - #TODO: if n.status() == 'OK': + # + totime = ET.SubElement(result, 'TimeBehind') + totime.text = str(n.totaltime() - runners_ranked[0].totaltime()) + # rank = ET.SubElement(result, 'Rank') rank.text = str(n.rank(runners)) status = ET.SubElement(result, 'Status')