summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2021-02-11 12:14:10 +0530
committerGitHub2021-02-11 12:14:10 +0530
commit546458cd40d847015363f7c085d7f72733036498 (patch)
treefc28bda08790903a9bb133140419b10b8a5d19ff
parentfc2da8b120415bc22825ea57d5a8b453b63ab838 (diff)
parent0cd8412008172dc30a54f4ecc59f719b1099ae44 (diff)
downloadonline_test-546458cd40d847015363f7c085d7f72733036498.tar.gz
online_test-546458cd40d847015363f7c085d7f72733036498.tar.bz2
online_test-546458cd40d847015363f7c085d7f72733036498.zip
Merge pull request #817 from adityacp/hot_fix_2
Fix issue in montior for Nonetype
-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