diff options
author | adityacp | 2021-02-11 12:12:39 +0530 |
---|---|---|
committer | adityacp | 2021-02-11 12:12:39 +0530 |
commit | 0cd8412008172dc30a54f4ecc59f719b1099ae44 (patch) | |
tree | fc28bda08790903a9bb133140419b10b8a5d19ff | |
parent | fc2da8b120415bc22825ea57d5a8b453b63ab838 (diff) | |
download | online_test-0cd8412008172dc30a54f4ecc59f719b1099ae44.tar.gz online_test-0cd8412008172dc30a54f4ecc59f719b1099ae44.tar.bz2 online_test-0cd8412008172dc30a54f4ecc59f719b1099ae44.zip |
Fix issue in montior for Nonetype
-rw-r--r-- | yaksh/templatetags/custom_filters.py | 6 |
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 |