From f3de9c3b4e6e06aed3d18fb7d01a6f998a4d8678 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 23 Feb 2018 12:13:30 -0500 Subject: [PATCH] Fix goal chart being broken if >100% --- templates/goal.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/templates/goal.html b/templates/goal.html index 714056a..9038bfe 100644 --- a/templates/goal.html +++ b/templates/goal.html @@ -6,9 +6,15 @@ {% set total_count = recurring_count + patreon_count + lp_count %} {% if _cfg("goal") %} {% set goal = int(_cfg("goal")) %} - {% set recurring_progress = recurring_sum / goal %} - {% set patreon_progress = patreon_sum / goal %} - {% set lp_progress = lp_sum / goal %} + + {% if goal < total_sum %} + {# Make the graph still make sense if we exceeded the goal #} + {% set adjusted_goal = total_sum %} + {% endif %} + + {% set recurring_progress = recurring_sum / adjusted_goal %} + {% set patreon_progress = patreon_sum / adjusted_goal %} + {% set lp_progress = lp_sum / adjusted_goal %} {% set progress = total_sum / goal %}