Hi guys!
I’d like to create in a code functionality to somehow block next chapters until administrator accept assignment and also administrator has the right to decline assignment in that case user should rewrite their code and send other link to git. After completion of all assignments in current chapter. I’d like to open next chapter. And by assignment I mean customized one. I’d like to make assignment accept filetype string or something like that in order to pass GitHub pull request url as answer for it.
I tried to create my own plugin for it here is the example:
def github_url_renderer(lesson_name):
lesson = frappe.get_doc("Course Lesson", lesson_name)
if not lesson:
return " <div class='alert alert-info'>" + _("Need to pass lesson name") +"</div>"
member = get_membership(lesson.course, frappe.session.user)
if not member:
return " <div class='alert alert-info'>" + _("Нужно быть участником курса") +"</div>"
result = frappe.get_all(
"LMS Solution Pull Request",
fields="*",
filters={"member": member.name, "lesson": lesson_name},
order_by="creation desc",
page_length=1,
)
if result:
url = result[0].github_url
else:
url = ""
context = dict(github_url=url)
return frappe.render_template("templates/send_github_pr.html", context)
It’s working fine however I’ve no idea how to block other chapters until all assignments are completed and wait for approval of administrator.