Fix: Fingerprints were ignoring the time and only recording the date

This commit is contained in:
Amritanshu Agrawal 2021-11-21 11:50:53 +05:30
parent d21d4e2a09
commit 7c352eb2e2

View File

@ -37,7 +37,7 @@ def upload_prints(
for id_, code in db.execute(select(Employee.id, Employee.code)).all():
employees[code] = id_
file_data = read_file(fingerprints)
prints = [d for d in fp(file_data, employees) if start <= d.date <= finish]
prints = [d for d in fp(file_data, employees) if start <= d.date.date() <= finish]
paged_data = [prints[i : i + 100] for i in range(0, len(prints), 100)]
for i, page in enumerate(paged_data):
print(f"Processing page {i} of {len(paged_data)}")
@ -90,7 +90,7 @@ def fp(file_data: StringIO, employees: Dict[int, uuid.UUID]) -> List[schemas.Fin
for row in reader:
try:
employee_code = int(row[employee_column]) # EnNo
date_ = datetime.strptime(row[date_column], date_format).date()
date_ = datetime.strptime(row[date_column], date_format)
if employee_code in employees.keys():
fingerprints.append(
schemas.Fingerprint(