From 7d8a433d97b9496293751fdb76518fc31eadf674 Mon Sep 17 00:00:00 2001 From: "Jeison Yehuda Amihud (Blender Dumbass)" Date: Sun, 5 Feb 2023 03:53:09 +0000 Subject: [PATCH] Few Corrections to the Start Algorithm --- studio/analytics.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/studio/analytics.py b/studio/analytics.py index 68e200d..0b7c89b 100644 --- a/studio/analytics.py +++ b/studio/analytics.py @@ -829,13 +829,18 @@ def load(project_location): # Needed try: - data["needed"] = ( 1 - data["fraction"] ) / ( data["duration"] - data["dayspassed"] ) + alldates = list(reversed(data["dates"].keys())) + prevdate = alldates[alldates.index(today)+1] + prev_frac = data["dates"][prevdate].get("fractions", {}).get("project", data["fraction"]) + data["needed"] = ( 1 - prev_frac ) / ( data["duration"] - data["dayspassed"] ) except: data["needed"] = 0 prev_star = data.get("star", 0) try: - prev_frac = data["dates"][list(reversed(data["dates"].keys()))[1]].get("fractions", {}).get("project", data["fraction"]) + alldates = list(reversed(data["dates"].keys())) + prevdate = alldates[alldates.index(today)+1] + prev_frac = data["dates"][prevdate].get("fractions", {}).get("project", data["fraction"]) data["star"] = (data["fraction"] - prev_frac) / data["needed"] except: data["star"] = 0