From 0cd8412008172dc30a54f4ecc59f719b1099ae44 Mon Sep 17 00:00:00 2001 From: adityacp Date: Thu, 11 Feb 2021 12:12:39 +0530 Subject: Fix issue in montior for Nonetype --- yaksh/templatetags/custom_filters.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'yaksh') diff --git a/yaksh/templatetags/custom_filters.py b/yaksh/templatetags/custom_filters.py index 78f321f..b404758 100644 --- a/yaksh/templatetags/custom_filters.py +++ b/yaksh/templatetags/custom_filters.py @@ -202,7 +202,7 @@ def has_lesson_video(lesson_id): @register.simple_tag def get_tc_percent(tc_id, data): - return data.get(str(tc_id), 0) + return data.get(str(tc_id), 0) if data else None @register.simple_tag @@ -215,9 +215,9 @@ def get_lesson_views(course_id, lesson_id): @register.simple_tag def get_percent_value(dictionary, key, total): - return round((dictionary.get(str(key), 0)/total)*100) + return round((dictionary.get(str(key), 0)/total)*100) if dictionary else None @register.simple_tag def get_dict_value(dictionary, key): - return dictionary.get(key, 0) + return dictionary.get(key, 0) if dictionary else None -- cgit