diff --git a/CTFd/plugins/dynamic_challenges/__init__.py b/CTFd/plugins/dynamic_challenges/__init__.py index 24591428..ab7aaca2 100644 --- a/CTFd/plugins/dynamic_challenges/__init__.py +++ b/CTFd/plugins/dynamic_challenges/__init__.py @@ -69,6 +69,11 @@ class DynamicValueChallenge(BaseChallenge): # We subtract -1 to allow the first solver to get max point value solve_count -= 1 + # Handle situations where admins have entered a 0 decay + # This is invalid as it can cause a division by zero + if challenge.decay == 0: + challenge.decay = 1 + # It is important that this calculation takes into account floats. # Hence this file uses from __future__ import division value = ( diff --git a/CTFd/plugins/dynamic_challenges/assets/create.html b/CTFd/plugins/dynamic_challenges/assets/create.html index c6e261e8..d8f3e2a1 100644 --- a/CTFd/plugins/dynamic_challenges/assets/create.html +++ b/CTFd/plugins/dynamic_challenges/assets/create.html @@ -25,7 +25,7 @@ The amount of solves before the challenge reaches its minimum value - +