Fix: Updated to match the fingerprint uploader to the new attendance machine
This commit is contained in:
parent
33b14b1ec0
commit
2e670c06ec
@ -351,15 +351,6 @@ class Fingerprint(Base):
|
||||
def query(cls):
|
||||
return DBSession.query(cls)
|
||||
|
||||
def create(self):
|
||||
old = DBSession.query(Fingerprint).filter(Fingerprint.date == self.date) \
|
||||
.filter(Fingerprint.employee_id == self.employee_id).first()
|
||||
if old is None:
|
||||
DBSession.add(self)
|
||||
return self
|
||||
else:
|
||||
return old
|
||||
|
||||
|
||||
class DbImage(Base):
|
||||
__tablename__ = 'images'
|
||||
|
@ -15,7 +15,7 @@ __author__ = 'tanshu'
|
||||
def show_list(request):
|
||||
filename = request.POST['uploadedFile'].filename
|
||||
input_file = request.POST['uploadedFile'].file
|
||||
reader = csv.reader(read_file(input_file), delimiter=";")
|
||||
reader = csv.reader(read_file(input_file), delimiter="\t")
|
||||
for row in reader:
|
||||
add_fingerprint(row)
|
||||
transaction.commit()
|
||||
@ -35,12 +35,18 @@ def read_file(input_file):
|
||||
|
||||
def add_fingerprint(row):
|
||||
try:
|
||||
employee_code = int(row[0])
|
||||
date = datetime.datetime.strptime(row[3] + ' ' + row[4], '%m/%d/%Y %H:%M')
|
||||
employee_code = int(row[2])
|
||||
date = datetime.datetime.strptime(row[6], '%Y/%m/%d %H:%M:%S')
|
||||
except ValueError:
|
||||
return
|
||||
employee_id = Employee.by_code(employee_code).id
|
||||
Fingerprint(employee_id=employee_id, date=date).create()
|
||||
employee = Employee.by_code(employee_code)
|
||||
if employee is not None:
|
||||
fp = Fingerprint(employee_id=employee.id, date=date)
|
||||
old = DBSession.query(Fingerprint).filter(Fingerprint.date == date) \
|
||||
.filter(Fingerprint.employee_id == employee.id).first()
|
||||
if old is None:
|
||||
DBSession.add(fp)
|
||||
|
||||
|
||||
|
||||
def get_prints(employee_id, date):
|
||||
|
Loading…
Reference in New Issue
Block a user