feat: Quiz attempt limits is configurable

- Added a 'no limit' check to `check_quiz_completion` in utils.py
- Added disabled flag for questions in quiz component
- Refactored `get_quiz_without_answers` to send attempt limit data to client
This commit is contained in:
scmmishra
2019-03-29 12:45:08 +05:30
parent d4ed56af02
commit 2b7e158e50
5 changed files with 39 additions and 19 deletions

View File

@@ -135,7 +135,7 @@ def check_content_completion(content_name, content_type, enrollment_name):
def check_quiz_completion(quiz, enrollment_name):
attempts = frappe.get_all("Quiz Activity", filters={'enrollment': enrollment_name, 'quiz': quiz.name}, fields=["name", "activity_date", "score", "status"])
status = bool(len(attempts) == quiz.max_attempts)
status = False if quiz.max_attempts == 0 else bool(len(attempts) == quiz.max_attempts)
score = None
result = None
if attempts: