From ea30876f033ccb92261e267f9bdc393aaf09b798 Mon Sep 17 00:00:00 2001 From: "[esekyi]" <[sskert10@gmail.com]> Date: Tue, 17 Sep 2024 06:59:48 +0000 Subject: [PATCH] =?UTF-8?q?[Fixes=F0=9F=9B=A0=EF=B8=8F]=20view=20count=20i?= =?UTF-8?q?ncrement=20typeError=20-=20NoneType=20and=20int?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/recipe.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/recipe.py b/app/models/recipe.py index 8727d43..e6a6bc7 100644 --- a/app/models/recipe.py +++ b/app/models/recipe.py @@ -35,6 +35,8 @@ def __repr__(self): def increment_view_count(self): """Increment the view count without updating the updated_at timestamp.""" + if self.view_count is None: # Check if view_count is None + self.view_count = 0 # Initialize to 0 if None self.view_count += 1 db.session.commit() # No commit or onupdate manipulation here