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