From 58f864abddd7db3578388b8734c6a7d5ce183a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Pelay?= <45865185+jpelay@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:25:04 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=B2=20Fix=20view=20programs=20for=20no?= =?UTF-8?q?n=20students=20(#5903)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When trying to access a program from a user that's not in a class, the paged failed due to indexing an empty dictionary. **How to test** * Go to http://localhost:8080/hedy/30bd4e4ce84f40bca40b24b9295e1483/view and it should open normally. --- app.py | 2 +- templates/view-program-page.html | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 42b5e0dfcf8..7ed863310b9 100644 --- a/app.py +++ b/app.py @@ -1965,7 +1965,7 @@ def view_program(user, id): level=int(result['level']), code=code), is_teacher=user['is_teacher'], - class_id=student_customizations['id'], + class_id=student_customizations.get('id'), next_program_id=next_program_id, next_classmate_program_id=next_classmate_adventure_id, **arguments_dict) diff --git a/templates/view-program-page.html b/templates/view-program-page.html index 9945b2c5a51..477820676f4 100644 --- a/templates/view-program-page.html +++ b/templates/view-program-page.html @@ -34,9 +34,11 @@