Added test if retired sets not existing
This commit is contained in:
parent
44cc91c26a
commit
d650627710
27
app.py
27
app.py
@ -547,24 +547,27 @@ def wishlist():
|
|||||||
cursor.close()
|
cursor.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
retired_sets_dict = {}
|
|
||||||
|
|
||||||
with open('retired_sets.csv', mode='r', encoding='utf-8') as csvfile:
|
|
||||||
reader = csv.reader(csvfile)
|
|
||||||
header = next(reader)
|
|
||||||
for row in reader:
|
|
||||||
key = row[2]
|
|
||||||
retired_sets_dict[key] = row
|
|
||||||
|
|
||||||
conn = sqlite3.connect('app.db')
|
conn = sqlite3.connect('app.db')
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.execute('SELECT * from wishlist;')
|
cursor.execute('SELECT * from wishlist;')
|
||||||
|
|
||||||
results = cursor.fetchall()
|
results = cursor.fetchall()
|
||||||
wishlist = [list(i) for i in results]
|
wishlist = [list(i) for i in results]
|
||||||
for w in wishlist:
|
retired_sets_dict = {}
|
||||||
set_num = w[0].split('-')[0]
|
|
||||||
w.append(retired_sets_dict.get(set_num,[""]*7)[6])
|
try:
|
||||||
|
with open('retired_sets.csv', mode='r', encoding='utf-8') as csvfile:
|
||||||
|
reader = csv.reader(csvfile)
|
||||||
|
header = next(reader)
|
||||||
|
for row in reader:
|
||||||
|
key = row[2]
|
||||||
|
retired_sets_dict[key] = row
|
||||||
|
for w in wishlist:
|
||||||
|
set_num = w[0].split('-')[0]
|
||||||
|
w.append(retired_sets_dict.get(set_num,[""]*7)[6])
|
||||||
|
except:
|
||||||
|
print('No retired list')
|
||||||
|
|
||||||
if wishlist == None or wishlist == '':
|
if wishlist == None or wishlist == '':
|
||||||
wishlist = ''
|
wishlist = ''
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
Loading…
Reference in New Issue
Block a user