comment clean up
This commit is contained in:
@@ -17,19 +17,12 @@ async def read_all_medicine():
|
|||||||
return getMedicineData()
|
return getMedicineData()
|
||||||
|
|
||||||
def getMedicineData():
|
def getMedicineData():
|
||||||
# location = Path(__file__).parent()
|
|
||||||
# medFile = (location / 'medicines/Database-Of-Medicine-Prices-31-May-2024.xls').resolve()
|
|
||||||
path = os.getcwd()
|
path = os.getcwd()
|
||||||
parentDir = os.path.abspath(os.path.join(path, os.pardir))
|
parentDir = os.path.abspath(os.path.join(path, os.pardir))
|
||||||
filePath = os.path.join(path, "backend/medicines", "Database-Of-Medicine-Prices-31-May-2024.xls")
|
filePath = os.path.join(path, "backend/medicines", "Database-Of-Medicine-Prices-31-May-2024.xls")
|
||||||
# print(f"C Path : %s", path)
|
|
||||||
# print(f"P Path : %s", parentDir)
|
|
||||||
# print(f"F Path : %s", filePath)
|
|
||||||
book = xlrd.open_workbook_xls(filePath)
|
book = xlrd.open_workbook_xls(filePath)
|
||||||
sh = book.sheet_by_index(0)
|
sh = book.sheet_by_index(0)
|
||||||
#print("{0} {1} {2}".format(sh.name, sh.nrows, sh.ncols))
|
|
||||||
medlist = []
|
medlist = []
|
||||||
|
|
||||||
for rx in range(1,sh.nrows):
|
for rx in range(1,sh.nrows):
|
||||||
if(str(sh.cell_value(rx, 6)).strip() != ""):
|
if(str(sh.cell_value(rx, 6)).strip() != ""):
|
||||||
medlist.append({
|
medlist.append({
|
||||||
@@ -45,15 +38,5 @@ def getMedicineData():
|
|||||||
if t not in seen:
|
if t not in seen:
|
||||||
seen.add(t)
|
seen.add(t)
|
||||||
medlist_noDuplicates.append(d)
|
medlist_noDuplicates.append(d)
|
||||||
|
|
||||||
return sorted(medlist_noDuplicates, key=lambda d: d['name']) #qsort(medlist)
|
return sorted(medlist_noDuplicates, key=lambda d: d['name']) #qsort(medlist)
|
||||||
|
|
||||||
|
|
||||||
def qsort(inlist):
|
|
||||||
if inlist == []:
|
|
||||||
return []
|
|
||||||
else:
|
|
||||||
pivot = inlist[0]
|
|
||||||
lesser = qsort([x for x in inlist[1:] if x < pivot])
|
|
||||||
greater = qsort([x for x in inlist[1:] if x >= pivot])
|
|
||||||
return lesser + [pivot] + greater
|
|
||||||
Reference in New Issue
Block a user