mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-14 18:07:22 +00:00
fixed TOTALS
This commit is contained in:
@@ -249,7 +249,7 @@ class JobQueue:
|
|||||||
if module in ["runlabel", "date", "test", "TOTAL"]:
|
if module in ["runlabel", "date", "test", "TOTAL"]:
|
||||||
continue
|
continue
|
||||||
# print(i, module, f"length={len(self.results[module])} ")
|
# print(i, module, f"length={len(self.results[module])} ")
|
||||||
if (i in self.results[module]) and self.results[module][i]:
|
if self.results[module][i]:
|
||||||
total += float(self.results[module][i])
|
total += float(self.results[module][i])
|
||||||
return total
|
return total
|
||||||
|
|
||||||
@@ -261,19 +261,17 @@ class JobQueue:
|
|||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
for j in data:
|
for j in data:
|
||||||
self.results[j] = data[j]
|
self.results[j] = data[j]
|
||||||
# print(data[j])
|
|
||||||
except:
|
except:
|
||||||
print(f"FAILURE parsing JSON file {self.tfile}")
|
print(f"FAILURE parsing JSON file {self.tfile}")
|
||||||
# Python bug: https://github.com/ShinNoNoir/twitterwebsearch/issues/12
|
# Python bug: https://github.com/ShinNoNoir/twitterwebsearch/issues/12
|
||||||
f.close()
|
f.close()
|
||||||
self.results["TOTAL"] = []
|
self.results["TOTAL"] = []
|
||||||
for i in range(len(self.results["date"])):
|
for i in range(len(self.results["date"])):
|
||||||
|
self.format_date(i)
|
||||||
|
print(i, self.compute_total(i))
|
||||||
self.results["TOTAL"].append(self.compute_total(i))
|
self.results["TOTAL"].append(self.compute_total(i))
|
||||||
|
|
||||||
for j in self.results_order:
|
for j in self.results_order:
|
||||||
# if j == "TOTAL":
|
|
||||||
# # do not append None to total as it has not been computed yet.
|
|
||||||
# continue
|
|
||||||
self.results[j].append(None) # append a placeholder
|
self.results[j].append(None) # append a placeholder
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -357,6 +355,23 @@ class JobQueue:
|
|||||||
self.saveprofiles()
|
self.saveprofiles()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def format_date(self,i):
|
||||||
|
# Calculate dates as days before last run
|
||||||
|
r = self.results["date"]
|
||||||
|
if r[i]:
|
||||||
|
if i == len(r) - 1:
|
||||||
|
print(" this", end=" ")
|
||||||
|
else:
|
||||||
|
# prints one place to the left of where you expect
|
||||||
|
if r[len(r) - 1]:
|
||||||
|
s = r[i] - r[len(r) - 1]
|
||||||
|
elif r[len(r) - 2]:
|
||||||
|
s = r[i] - r[len(r) - 2]
|
||||||
|
else:
|
||||||
|
s = 0
|
||||||
|
days = (s) / (24 * 60 * 60)
|
||||||
|
print(f"{days:8.2f}", end=" ")
|
||||||
|
|
||||||
def showprofile(self):
|
def showprofile(self):
|
||||||
"""Prints out the time it took to run the jobqueue"""
|
"""Prints out the time it took to run the jobqueue"""
|
||||||
RED = '\033[31m'
|
RED = '\033[31m'
|
||||||
@@ -386,20 +401,7 @@ class JobQueue:
|
|||||||
rp = " - "
|
rp = " - "
|
||||||
print("%8s" % rp, end=" ")
|
print("%8s" % rp, end=" ")
|
||||||
elif k == "date":
|
elif k == "date":
|
||||||
# Calculate dates as days before last run
|
self.format_date(i)
|
||||||
if r[i]:
|
|
||||||
if i == len(r) - 1:
|
|
||||||
print(" this", end=" ")
|
|
||||||
else:
|
|
||||||
# prints one place to the left of where you expect
|
|
||||||
if r[len(r) - 1]:
|
|
||||||
s = r[i] - r[len(r) - 1]
|
|
||||||
elif r[len(r) - 2]:
|
|
||||||
s = r[i] - r[len(r) - 2]
|
|
||||||
else:
|
|
||||||
s = 0
|
|
||||||
days = (s) / (24 * 60 * 60)
|
|
||||||
print(f"{days:8.2f}", end=" ")
|
|
||||||
elif r[i]:
|
elif r[i]:
|
||||||
print(f"{r[i]:8.1f}", end=" ")
|
print(f"{r[i]:8.1f}", end=" ")
|
||||||
if i == len(r) - 1 and r[i - 1]:
|
if i == len(r) - 1 and r[i - 1]:
|
||||||
|
|||||||
Reference in New Issue
Block a user