From 86fd6e39c92cdf2c45a7ab19bd67acfc3d95646f Mon Sep 17 00:00:00 2001
From: sc01879 <sc01879@surrey.ac.uk>
Date: Sat, 15 May 2021 04:15:37 +0100
Subject: [PATCH] Back Checks done

---
 app/controllers/habits_controller.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/controllers/habits_controller.rb b/app/controllers/habits_controller.rb
index ce82289..fc54465 100644
--- a/app/controllers/habits_controller.rb
+++ b/app/controllers/habits_controller.rb
@@ -85,7 +85,7 @@ class HabitsController < ApplicationController
       end
     end
 
-    if @habit.streak > @habit.max_streak || @habit.max_streak.nil?
+    if @habit.max_streak.nil? || @habit.streak > @habit.max_streak
       @habit.max_streak = @habit.streak
       @habit.save
     end
-- 
GitLab