fixed a bug with getting data not filling in total hashrate because of a key error on data points with no data
This commit is contained in:
@@ -196,8 +196,17 @@ async def get_data(ip_list: list):
|
|||||||
progress_bar_len += 1
|
progress_bar_len += 1
|
||||||
asyncio.create_task(update_prog_bar(progress_bar_len))
|
asyncio.create_task(update_prog_bar(progress_bar_len))
|
||||||
|
|
||||||
hashrate_list = [float(item[3].replace(" TH/s", "")) if not item[3] == '' else 0 for item in
|
hashrate_list = []
|
||||||
window["ip_table"].Values]
|
hr_idx = 3
|
||||||
|
for item, _ in enumerate(window["ip_table"].Values):
|
||||||
|
if len(window["ip_table"].Values[item]) > hr_idx:
|
||||||
|
if not window["ip_table"].Values[item][hr_idx] == '':
|
||||||
|
hashrate_list.append(float(window["ip_table"].Values[item][hr_idx].replace(" TH/s", "")))
|
||||||
|
else:
|
||||||
|
hashrate_list.append(0)
|
||||||
|
else:
|
||||||
|
hashrate_list.append(0)
|
||||||
|
|
||||||
total_hr = round(sum(hashrate_list), 2)
|
total_hr = round(sum(hashrate_list), 2)
|
||||||
window["hr_total"].update(f"{total_hr} TH/s")
|
window["hr_total"].update(f"{total_hr} TH/s")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user