Add checkin/out beta
This commit is contained in:
@@ -88,7 +88,7 @@ def init():
|
||||
db.create_tables([location, office, item, component, user])
|
||||
print("Database initialized.")
|
||||
global search
|
||||
print("Creating cache index... ", end='', flush=True)
|
||||
print("Creating cache index...", end='', flush=True)
|
||||
search = ivs()
|
||||
add = item.select().dicts()
|
||||
#print(add)
|
||||
@@ -101,7 +101,8 @@ def init():
|
||||
#print(itm)
|
||||
#print(type(itm))
|
||||
search.add_document(itm)
|
||||
print(len(add))
|
||||
print('.',end='',flush=True)
|
||||
print(" " + str(len(add)), "items added.")
|
||||
print("Cache build complete.")
|
||||
|
||||
def search_item(query, filters: dict={}):
|
||||
@@ -266,6 +267,8 @@ def change_password(username, password):
|
||||
|
||||
def checkout(user, barcode, loc=None):
|
||||
itm = get_item(barcode)
|
||||
if loc == False:
|
||||
loc = None
|
||||
if itm:
|
||||
itm.checkout = True
|
||||
itm.checkout_user = user
|
||||
@@ -277,6 +280,8 @@ def checkout(user, barcode, loc=None):
|
||||
|
||||
def checkin(user, barcode, loc=None):
|
||||
itm = get_item(barcode)
|
||||
if loc == False:
|
||||
loc = None
|
||||
if itm:
|
||||
itm.checkout = False
|
||||
itm.last_user = user
|
||||
|
||||
Reference in New Issue
Block a user