Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pncakespoon1 committed Nov 22, 2022
1 parent af5caee commit 07c3143
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions ResetTracker/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ def getMean(cls, data):

@classmethod
def getQuotient(cls, dividend, divisor):
if divisor == 0:
return None
else:
return dividend/divisor
quotient = None
try:
quotient = dividend/divisor
except Exception as e:
pass
return quotient

@classmethod
def getTimezoneOffset(cls):
Expand Down Expand Up @@ -345,9 +347,9 @@ def get_stats(cls, session, makeScoreKeys):
if key in ['Nether', 'Bastion', 'Fortress', 'Nether Exit', 'Stronghold', 'End']:
prevKey = key

returndict['general stats'] = {'inph': 3600 * Logistics.getQuotient(returndict['splits stats']['Nether']['Count'], (total_owTime)),
'rnph': 3600 * Logistics.getQuotient(returndict['splits stats']['Nether']['Count'], (total_owTime + total_wallTime)),
'tnph': 3600 * Logistics.getQuotient(returndict['splits stats']['Nether']['Count'], (total_RTA + total_wallTime)),
returndict['general stats'] = {'inph': Logistics.getQuotient(Logistics.getQuotient(returndict['splits stats']['Nether']['Count'], (total_owTime)), 1/3600),
'rnph': Logistics.getQuotient(Logistics.getQuotient(returndict['splits stats']['Nether']['Count'], (total_owTime + total_wallTime)), 1/3600),
'tnph': Logistics.getQuotient(Logistics.getQuotient(returndict['splits stats']['Nether']['Count'], (total_RTA + total_wallTime)), 1/3600),
'total time': total_RTA,
'total Walltime': total_wallTime,
'total ow time': total_owTime,
Expand Down Expand Up @@ -528,7 +530,7 @@ def updateCurrentSession(cls, data):
if split not in ['Iron', 'Wood', 'Iron Pickaxe']:
prevSplit = split

currentSession['general stats']['rnph'] = Logistics.getQuotient(currentSession['splits stats']['Nether']['Count'], currentSession['general stats']['total wall time'] + currentSession['general stats']['total ow time'])
currentSession['general stats']['rnph'] = Logistics.getQuotient(Logistics.getQuotient(currentSession['splits stats']['Nether']['Count'], currentSession['general stats']['total wall time'] + currentSession['general stats']['total ow time']), 1/3600)
currentSession['general stats']['% played'] = Logistics.getQuotient(currentSession['general stats']['total played'], currentSession['general stats']['total played'] + currentSession['general stats']['total wall resets'])
currentSession['general stats']['rpe'] = Logistics.getQuotient(currentSession['general stats']['total wall resets'] + currentSession['general stats']['total played'], currentSession['splits stats']['Nether']['Count'])

Expand Down Expand Up @@ -855,12 +857,11 @@ class CompareProfiles:
class Sheets:
@classmethod
def setup(cls):
wks1.update_row(index=0, values=['Date and Time', 'Iron Source', 'Enter Type', 'Gold Source', 'Spawn Biome', 'RTA', 'Wood', 'Iron Pickaxe', 'Nether', 'Bastion', 'Fortress', 'Nether Exit', 'Stronghold', 'End', 'Retimed IGT', 'IGT', 'Gold Dropped', 'Blaze Rods', 'Blazes', 'Flint', 'Gravel', 'Deaths', 'Traded', 'Endermen', 'Eyes Thrown', 'Iron', 'Wall Resets Since Prev', 'Played Since Prev', 'RTA Since Prev', 'Break RTA Since Prev', 'Wall Time Since Prev', 'Session Marker'], col_offset=0)
wks1.update_row(index=1, values=['Date and Time', 'Iron Source', 'Enter Type', 'Gold Source', 'Spawn Biome', 'RTA', 'Wood', 'Iron Pickaxe', 'Nether', 'Bastion', 'Fortress', 'Nether Exit', 'Stronghold', 'End', 'Retimed IGT', 'IGT', 'Gold Dropped', 'Blaze Rods', 'Blazes', 'Flint', 'Gravel', 'Deaths', 'Traded', 'Endermen', 'Eyes Thrown', 'Iron', 'Wall Resets Since Prev', 'Played Since Prev', 'RTA Since Prev', 'Break RTA Since Prev', 'Wall Time Since Prev', 'Session Marker'], col_offset=0)

@classmethod
def sheets(cls):
try:
Sheets.setup()
# Setting up constants and verifying
color = (15.0, 15.0, 15.0)
global pushedLines
Expand Down Expand Up @@ -1178,6 +1179,7 @@ def on_created(self, evt):
class Tracking:
@classmethod
def trackResets(cls):
Sheets.setup()
while True:
try:
newRecordObserver = Observer()
Expand Down Expand Up @@ -1625,6 +1627,7 @@ def __init__(self, *args, **kwargs):

pages[0].show()


if __name__ == "__main__":
root = tk.Tk()
menubar = Menu(root)
Expand Down

0 comments on commit 07c3143

Please sign in to comment.