summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yaksh/templatetags/custom_filters.py6
1 files changed, 3 insertions, 3 deletions
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