chore: fixed linters
This commit is contained in:
@@ -140,20 +140,7 @@ def get_quiz_progress(lesson):
|
|||||||
quizzes = [value for name, value in macros if name == "Quiz"]
|
quizzes = [value for name, value in macros if name == "Quiz"]
|
||||||
|
|
||||||
for quiz in quizzes:
|
for quiz in quizzes:
|
||||||
print(quiz)
|
|
||||||
passing_percentage = frappe.db.get_value("LMS Quiz", quiz, "passing_percentage")
|
passing_percentage = frappe.db.get_value("LMS Quiz", quiz, "passing_percentage")
|
||||||
print(frappe.session.user)
|
|
||||||
print(passing_percentage)
|
|
||||||
print(
|
|
||||||
frappe.db.exists(
|
|
||||||
"LMS Quiz Submission",
|
|
||||||
{
|
|
||||||
"quiz": quiz,
|
|
||||||
"member": frappe.session.user,
|
|
||||||
"percentage": [">=", passing_percentage],
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if not frappe.db.exists(
|
if not frappe.db.exists(
|
||||||
"LMS Quiz Submission",
|
"LMS Quiz Submission",
|
||||||
{
|
{
|
||||||
@@ -162,7 +149,6 @@ def get_quiz_progress(lesson):
|
|||||||
"percentage": [">=", passing_percentage],
|
"percentage": [">=", passing_percentage],
|
||||||
},
|
},
|
||||||
):
|
):
|
||||||
print("no submission")
|
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
import frappe
|
import frappe
|
||||||
import json
|
import json
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
from frappe import _
|
||||||
|
|
||||||
|
|
||||||
class LMSBadge(Document):
|
class LMSBadge(Document):
|
||||||
@@ -12,12 +13,12 @@ class LMSBadge(Document):
|
|||||||
try:
|
try:
|
||||||
json.loads(self.condition)
|
json.loads(self.condition)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
frappe.throw("Condition must be in valid JSON format.")
|
frappe.throw(_("Condition must be in valid JSON format."))
|
||||||
elif self.condition:
|
elif self.condition:
|
||||||
try:
|
try:
|
||||||
compile(self.condition, "<string>", "eval")
|
compile(self.condition, "<string>", "eval")
|
||||||
except Exception:
|
except Exception:
|
||||||
frappe.throw("Condition must be valid python code.")
|
frappe.throw(_("Condition must be valid python code."))
|
||||||
|
|
||||||
def apply(self, doc):
|
def apply(self, doc):
|
||||||
if self.rule_condition_satisfied(doc):
|
if self.rule_condition_satisfied(doc):
|
||||||
@@ -73,10 +74,8 @@ def assign_badge(badge):
|
|||||||
return
|
return
|
||||||
|
|
||||||
fields = ["name"]
|
fields = ["name"]
|
||||||
print(badge.user_field)
|
|
||||||
fields.append(badge.user_field)
|
fields.append(badge.user_field)
|
||||||
list = frappe.get_all(badge.reference_doctype, filters=badge.condition, fields=fields)
|
list = frappe.get_all(badge.reference_doctype, filters=badge.condition, fields=fields)
|
||||||
print(list)
|
|
||||||
for doc in list:
|
for doc in list:
|
||||||
award(badge, doc.get(badge.user_field))
|
award(badge, doc.get(badge.user_field))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user