Litt arbeid på xml eksport
This commit is contained in:
parent
77e7b25587
commit
ebe25acca8
6
cli.py
6
cli.py
@ -71,4 +71,8 @@ if __name__ == "__main__":
|
|||||||
#print_o_classes(o_classes)
|
#print_o_classes(o_classes)
|
||||||
#print_class_splits(runner_list, o_classes[0])
|
#print_class_splits(runner_list, o_classes[0])
|
||||||
#print(otime.check_codes(runner_list[1]))
|
#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))
|
||||||
|
11
otime.py
11
otime.py
@ -39,6 +39,8 @@ class runner:
|
|||||||
def rank(self, allrunners):
|
def rank(self, allrunners):
|
||||||
c_ranked = rank_runners(allrunners, self.o_class)
|
c_ranked = rank_runners(allrunners, self.o_class)
|
||||||
return c_ranked.index(self) + 1
|
return c_ranked.index(self) + 1
|
||||||
|
def res_splits(self):
|
||||||
|
pass
|
||||||
|
|
||||||
class course:
|
class course:
|
||||||
def __init__(self, name, codes):
|
def __init__(self, name, codes):
|
||||||
@ -217,7 +219,9 @@ def gen_xml_result(runners, o_classes):
|
|||||||
name = ET.SubElement(t, 'Name')
|
name = ET.SubElement(t, 'Name')
|
||||||
name.text = i.name
|
name.text = i.name
|
||||||
#<PersonResult>
|
#<PersonResult>
|
||||||
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_result = ET.SubElement(class_result, 'PersonResult')
|
||||||
#<Person>
|
#<Person>
|
||||||
person = ET.SubElement(person_result, 'Person')
|
person = ET.SubElement(person_result, 'Person')
|
||||||
@ -251,8 +255,11 @@ def gen_xml_result(runners, o_classes):
|
|||||||
finish_t.text = n.f_time.isoformat()
|
finish_t.text = n.f_time.isoformat()
|
||||||
time = ET.SubElement(result, 'Time')
|
time = ET.SubElement(result, 'Time')
|
||||||
time.text = str(n.totaltime())
|
time.text = str(n.totaltime())
|
||||||
#TODO:<TimeBehind>
|
|
||||||
if n.status() == 'OK':
|
if n.status() == 'OK':
|
||||||
|
#<TimeBehind>
|
||||||
|
totime = ET.SubElement(result, 'TimeBehind')
|
||||||
|
totime.text = str(n.totaltime() - runners_ranked[0].totaltime())
|
||||||
|
#</TimeBehind>
|
||||||
rank = ET.SubElement(result, 'Rank')
|
rank = ET.SubElement(result, 'Rank')
|
||||||
rank.text = str(n.rank(runners))
|
rank.text = str(n.rank(runners))
|
||||||
status = ET.SubElement(result, 'Status')
|
status = ET.SubElement(result, 'Status')
|
||||||
|
Loading…
Reference in New Issue
Block a user