fix: remove lesson assignment references

This commit is contained in:
Jannat Patel
2023-05-26 17:20:53 +05:30
parent 0432751050
commit 70a036e5a7
8 changed files with 16 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
// Copyright (c) 2021, Frappe and contributors // Copyright (c) 2021, Frappe and contributors
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on("Lesson Assignment", { frappe.ui.form.on("LMS Assignment Submission", {
// refresh: function(frm) { // refresh: function(frm) {
// } // }
}); });

View File

@@ -88,10 +88,10 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"make_attachments_public": 1, "make_attachments_public": 1,
"modified": "2023-03-27 13:24:18.696868", "modified": "2023-03-27 13:24:18.696869",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "LMS", "module": "LMS",
"name": "Lesson Assignment", "name": "LMS Assignment Submission",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {

View File

@@ -12,7 +12,7 @@ class LessonAssignment(Document):
def validate_duplicates(self): def validate_duplicates(self):
if frappe.db.exists( if frappe.db.exists(
"Lesson Assignment", "LMS Assignment Submission",
{"lesson": self.lesson, "member": self.member, "name": ["!=", self.name]}, {"lesson": self.lesson, "member": self.member, "name": ["!=", self.name]},
): ):
lesson_title = frappe.db.get_value("Course Lesson", self.lesson, "title") lesson_title = frappe.db.get_value("Course Lesson", self.lesson, "title")
@@ -26,13 +26,13 @@ class LessonAssignment(Document):
@frappe.whitelist() @frappe.whitelist()
def upload_assignment(assignment, lesson): def upload_assignment(assignment, lesson):
args = { args = {
"doctype": "Lesson Assignment", "doctype": "LMS Assignment Submission",
"lesson": lesson, "lesson": lesson,
"member": frappe.session.user, "member": frappe.session.user,
} }
if frappe.db.exists(args): if frappe.db.exists(args):
del args["doctype"] del args["doctype"]
frappe.db.set_value("Lesson Assignment", args, "assignment", assignment) frappe.db.set_value("LMS Assignment Submission", args, "assignment", assignment)
else: else:
args.update({"assignment": assignment}) args.update({"assignment": assignment})
lesson_work = frappe.get_doc(args) lesson_work = frappe.get_doc(args)
@@ -42,7 +42,7 @@ def upload_assignment(assignment, lesson):
@frappe.whitelist() @frappe.whitelist()
def get_assignment(lesson): def get_assignment(lesson):
assignment = frappe.db.get_value( assignment = frappe.db.get_value(
"Lesson Assignment", "LMS Assignment Submission",
{"lesson": lesson, "member": frappe.session.user}, {"lesson": lesson, "member": frappe.session.user},
["lesson", "member", "assignment", "comments", "status"], ["lesson", "member", "assignment", "comments", "status"],
as_dict=True, as_dict=True,
@@ -55,7 +55,7 @@ def get_assignment(lesson):
@frappe.whitelist() @frappe.whitelist()
def grade_assignment(name, result, comments): def grade_assignment(name, result, comments):
doc = frappe.get_doc("Lesson Assignment", name) doc = frappe.get_doc("LMS Assignment Submission", name)
doc.status = result doc.status = result
doc.comments = comments doc.comments = comments
doc.save(ignore_permissions=True) doc.save(ignore_permissions=True)

View File

@@ -1,11 +1,11 @@
{ {
"attach_print": 0, "attach_print": 0,
"channel": "Email", "channel": "Email",
"creation": "2023-03-27 16:34:03.505645", "creation": "2023-03-27 16:34:03.505647",
"days_in_advance": 0, "days_in_advance": 0,
"docstatus": 0, "docstatus": 0,
"doctype": "Notification", "doctype": "Notification",
"document_type": "Lesson Assignment", "document_type": "LMS Assignment Submission",
"enabled": 1, "enabled": 1,
"event": "New", "event": "New",
"idx": 0, "idx": 0,

View File

@@ -36,7 +36,7 @@ const save_assignment = (e) => {
message: __("Please grade the assignment."), message: __("Please grade the assignment."),
}); });
frappe.call({ frappe.call({
method: "lms.lms.doctype.lesson_assignment.lesson_assignment.grade_assignment", method: "lms.lms.doctype.lms_assignment_submission.lms_assignment_submission.grade_assignment",
args: { args: {
name: $(e.currentTarget).data("assignment"), name: $(e.currentTarget).data("assignment"),
result: this.result, result: this.result,

View File

@@ -8,7 +8,7 @@ def get_context(context):
assignment = frappe.form_dict["assignment"] assignment = frappe.form_dict["assignment"]
context.assignment = frappe.db.get_value( context.assignment = frappe.db.get_value(
"Lesson Assignment", "LMS Assignment Submission",
assignment, assignment,
[ [
"assignment", "assignment",

View File

@@ -374,7 +374,7 @@ const upload_file = (file, target) => {
const create_lesson_work = (file, target) => { const create_lesson_work = (file, target) => {
frappe.call({ frappe.call({
method: "lms.lms.doctype.lesson_assignment.lesson_assignment.upload_assignment", method: "lms.lms.doctype.lms_assignment_submission.lms_assignment_submission.upload_assignment",
args: { args: {
assignment: file.file_url, assignment: file.file_url,
lesson: $(".title").attr("data-lesson"), lesson: $(".title").attr("data-lesson"),
@@ -435,7 +435,7 @@ const clear_work = (e) => {
const fetch_assignments = () => { const fetch_assignments = () => {
if ($(".attach-file").length <= 0) return; if ($(".attach-file").length <= 0) return;
frappe.call({ frappe.call({
method: "lms.lms.doctype.lesson_assignment.lesson_assignment.get_assignment", method: "lms.lms.doctype.lms_assignment_submission.lms_assignment_submission.get_assignment",
args: { args: {
lesson: $(".title").attr("data-lesson"), lesson: $(".title").attr("data-lesson"),
}, },

View File

@@ -121,8 +121,8 @@
{% macro Assignment(course, student, is_moderator) %} {% macro Assignment(course, student, is_moderator) %}
{% for assignment in course.assignments %} {% for assignment in course.assignments %}
{% set filters = { "member": student.name, "course": course.course, "lesson": assignment.name } %} {% set filters = { "member": student.name, "course": course.course, "lesson": assignment.name } %}
{% set has_submitted = frappe.db.exists("Lesson Assignment", filters) %} {% set has_submitted = frappe.db.exists("LMS Assignment Submission", filters) %}
{% set submission = frappe.db.get_value("Lesson Assignment", filters, ["assignment", "creation", "status"], as_dict=True) %} {% set submission = frappe.db.get_value("LMS Assignment Submission", filters, ["assignment", "creation", "status"], as_dict=True) %}
{% set status = submission.status %} {% set status = submission.status %}
{% set color = "green" if status == "Pass" else "red" if status == "Fail" else "orange" %} {% set color = "green" if status == "Pass" else "red" if status == "Fail" else "orange" %}
{% set can_see_details = has_submitted and (is_moderator or frappe.session.user == student.name) %} {% set can_see_details = has_submitted and (is_moderator or frappe.session.user == student.name) %}