From a5749eb97e59c421d7c310a78376d6f7dbf967fb Mon Sep 17 00:00:00 2001 From: Italo Valcy Date: Mon, 10 Aug 2026 10:26:52 -0300 Subject: [PATCH] Handle null timestamps on finished_labs page The /finished_labs view crashed with an AttributeError when a LabInstances row had a NULL created_at (or updated_at), since strftime() was called directly on None. Guard both fields and render "--" when the timestamp is missing, matching the existing convention used for finish_reason. Co-Authored-By: Claude Opus 4.8 --- apps/home/routes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/home/routes.py b/apps/home/routes.py index 55a3843..c0365b5 100644 --- a/apps/home/routes.py +++ b/apps/home/routes.py @@ -1391,8 +1391,8 @@ def view_finished_labs(): "lab_id": li.lab_id, "lab_instance_id": li.id, "user": f"{user.name} ({user.email or 'NO-EMAIL'})", - "created": li.created_at.strftime('%Y-%m-%d %H:%M:%S'), - "finished": li.updated_at.strftime('%Y-%m-%d %H:%M:%S'), + "created": li.created_at.strftime('%Y-%m-%d %H:%M:%S') if li.created_at else "--", + "finished": li.updated_at.strftime('%Y-%m-%d %H:%M:%S') if li.updated_at else "--", "finish_reason": li.finish_reason or "--", }) return render_template("pages/finished_labs.html", segment="/finished_labs", labs=labs, groups=current_user_groups, filter_group=filter_group)