Fikset start_time og finish_time i brikkeobjektet.
This commit is contained in:
parent
a0d9f5edae
commit
4951861751
23
otime.py
23
otime.py
@ -230,10 +230,11 @@ class runner:
|
|||||||
return splits_cpy
|
return splits_cpy
|
||||||
|
|
||||||
class card_punch:
|
class card_punch:
|
||||||
def __init__(self, card, controls, splits, s_time, f_time):
|
def __init__(self, card, controls, splits, read_time, s_time, f_time):
|
||||||
self.card = card
|
self.card = card
|
||||||
self.controls = controls
|
self.controls = controls
|
||||||
self.splits = splits
|
self.splits = splits
|
||||||
|
self.read_time = read_time
|
||||||
self.s_time = s_time
|
self.s_time = s_time
|
||||||
self.f_time = f_time
|
self.f_time = f_time
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
@ -268,10 +269,14 @@ class card_punch:
|
|||||||
milliseconds = int.from_bytes(datamsg[14:16], 'little')
|
milliseconds = int.from_bytes(datamsg[14:16], 'little')
|
||||||
|
|
||||||
read_time = datetime.datetime(year, month, day, hours, minutes, seconds, milliseconds)
|
read_time = datetime.datetime(year, month, day, hours, minutes, seconds, milliseconds)
|
||||||
start_time = read_time - datetime.timedelta(seconds = splits[-1])
|
if len(controls) > 2:
|
||||||
finish_time = read_time - datetime.timedelta(seconds = splits[-2])
|
s_time = read_time - datetime.timedelta(seconds = splits[-1])
|
||||||
|
f_time = read_time - (datetime.timedelta(seconds = splits[-1]) + datetime.timedelta(seconds = splits[-2]))
|
||||||
|
else:
|
||||||
|
s_time = read_time
|
||||||
|
f_time = read_time
|
||||||
|
|
||||||
return(card_punch(card, controls, splits, start_time, finish_time))
|
return(card_punch(card, controls, splits, read_time, s_time, f_time))
|
||||||
|
|
||||||
def list_from_mtr_f(mtr_f):
|
def list_from_mtr_f(mtr_f):
|
||||||
csvreader = csv.reader(open(mtr_f))
|
csvreader = csv.reader(open(mtr_f))
|
||||||
@ -309,12 +314,14 @@ class card_punch:
|
|||||||
tl[1] = tl[1].split(':')
|
tl[1] = tl[1].split(':')
|
||||||
tl[1][2] = float(tl[1][2])
|
tl[1][2] = float(tl[1][2])
|
||||||
tl[1] = list(map(int, tl[1]))
|
tl[1] = list(map(int, tl[1]))
|
||||||
f_time = datetime.datetime(tl[0][2], tl[0][1], tl[0][0], tl[1][0], tl[1][1], tl[1][2])
|
read_time = datetime.datetime(tl[0][2], tl[0][1], tl[0][0], tl[1][0], tl[1][1], tl[1][2])
|
||||||
if len(controls) > 2:
|
if len(controls) > 2:
|
||||||
s_time = f_time - datetime.timedelta(seconds = splits[-2])
|
s_time = read_time - datetime.timedelta(seconds = splits[-1])
|
||||||
|
f_time = read_time - (datetime.timedelta(seconds = splits[-1]) + datetime.timedelta(seconds = splits[-2]))
|
||||||
else:
|
else:
|
||||||
s_time = f_time
|
s_time = read_time
|
||||||
cards.append(card_punch(int(row[6]), controls, splits, s_time, f_time))
|
f_time = read_time
|
||||||
|
cards.append(card_punch(int(row[6]), controls, splits, read_time, s_time, f_time))
|
||||||
return cards
|
return cards
|
||||||
class course:
|
class course:
|
||||||
def __init__(self, name, codes):
|
def __init__(self, name, codes):
|
||||||
|
Loading…
Reference in New Issue
Block a user