From 06ed74dc7cd188a25800a56819c7396cd2bf1dda Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 14 Dec 2016 17:49:47 +0530 Subject: [PATCH 1/7] Redesign Assessment Module --- erpnext/config/schools.py | 10 +- erpnext/schools/api.py | 38 ++ .../schools/doctype/assessment/assessment.js | 42 +- .../doctype/assessment/assessment.json | 177 ++--- .../schools/doctype/assessment/assessment.py | 21 +- .../__init__.py | 0 .../assessment_evaluation_criteria.json | 124 ++++ .../assessment_evaluation_criteria.py | 10 + .../assessment_result/assessment_result.js | 51 ++ .../assessment_result/assessment_result.json | 281 +++++++- .../assessment_result/assessment_result.py | 17 +- .../test_assessment_result.py | 12 + .../assessment_result_detail/__init__.py | 0 .../assessment_result_detail.json | 180 +++++ .../assessment_result_detail.py | 10 + erpnext/schools/doctype/course/course.json | 636 ++++++++++-------- erpnext/schools/doctype/course/course.py | 11 +- .../course_evaluation_criteria/__init__.py | 0 .../course_evaluation_criteria.json | 124 ++++ .../course_evaluation_criteria.py | 10 + .../doctype/evaluation_criteria/__init__.py | 0 .../evaluation_criteria.js | 8 + .../evaluation_criteria.json | 89 +++ .../evaluation_criteria.py | 10 + .../test_evaluation_criteria.py | 12 + .../grade_interval/grade_interval.json | 43 +- .../schools/doctype/grading_scale/__init__.py | 0 .../doctype/grading_scale/grading_scale.js | 8 + .../doctype/grading_scale/grading_scale.json | 203 ++++++ .../doctype/grading_scale/grading_scale.py | 10 + .../grading_scale/test_grading_scale.py | 12 + .../grading_scale_interval/__init__.py | 0 .../grading_scale_interval.json | 123 ++++ .../grading_scale_interval.py | 10 + .../grading_structure/grading_structure.json | 67 +- .../doctype/student/student_dashboard.py | 2 +- 36 files changed, 1886 insertions(+), 465 deletions(-) create mode 100644 erpnext/schools/doctype/assessment_evaluation_criteria/__init__.py create mode 100644 erpnext/schools/doctype/assessment_evaluation_criteria/assessment_evaluation_criteria.json create mode 100644 erpnext/schools/doctype/assessment_evaluation_criteria/assessment_evaluation_criteria.py create mode 100644 erpnext/schools/doctype/assessment_result/assessment_result.js create mode 100644 erpnext/schools/doctype/assessment_result/test_assessment_result.py create mode 100644 erpnext/schools/doctype/assessment_result_detail/__init__.py create mode 100644 erpnext/schools/doctype/assessment_result_detail/assessment_result_detail.json create mode 100644 erpnext/schools/doctype/assessment_result_detail/assessment_result_detail.py create mode 100644 erpnext/schools/doctype/course_evaluation_criteria/__init__.py create mode 100644 erpnext/schools/doctype/course_evaluation_criteria/course_evaluation_criteria.json create mode 100644 erpnext/schools/doctype/course_evaluation_criteria/course_evaluation_criteria.py create mode 100644 erpnext/schools/doctype/evaluation_criteria/__init__.py create mode 100644 erpnext/schools/doctype/evaluation_criteria/evaluation_criteria.js create mode 100644 erpnext/schools/doctype/evaluation_criteria/evaluation_criteria.json create mode 100644 erpnext/schools/doctype/evaluation_criteria/evaluation_criteria.py create mode 100644 erpnext/schools/doctype/evaluation_criteria/test_evaluation_criteria.py create mode 100644 erpnext/schools/doctype/grading_scale/__init__.py create mode 100644 erpnext/schools/doctype/grading_scale/grading_scale.js create mode 100644 erpnext/schools/doctype/grading_scale/grading_scale.json create mode 100644 erpnext/schools/doctype/grading_scale/grading_scale.py create mode 100644 erpnext/schools/doctype/grading_scale/test_grading_scale.py create mode 100644 erpnext/schools/doctype/grading_scale_interval/__init__.py create mode 100644 erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json create mode 100644 erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.py diff --git a/erpnext/config/schools.py b/erpnext/config/schools.py index 366810d9f5..581b520abe 100644 --- a/erpnext/config/schools.py +++ b/erpnext/config/schools.py @@ -120,7 +120,15 @@ def get_data(): }, { "type": "doctype", - "name": "Grading Structure" + "name": "Assessment Result" + }, + { + "type": "doctype", + "name": "Grading Scale" + }, + { + "type": "doctype", + "name": "Evaluation Criteria" } ] }, diff --git a/erpnext/schools/api.py b/erpnext/schools/api.py index bf09351ff5..a1e4a490b0 100644 --- a/erpnext/schools/api.py +++ b/erpnext/schools/api.py @@ -163,3 +163,41 @@ def get_course_schedule_events(start, end, filters=None): }, as_dict=True, update={"allDay": 0}) return data + +@frappe.whitelist() +def get_evaluation_criterias(course): + """Returns Evaluation Criterias and their Weightage from Course Master. + + :param Course: Course + """ + return frappe.get_list("Course Evaluation Criteria", \ + fields=["evaluation_criteria", "weightage"], filters={"parent": course}, order_by= "idx") + +@frappe.whitelist() +def get_assessment_details(assessment): + """Returns Evaluation Criteria and Maximum Score from Assessment Master. + + :param Assessment: Assessment + """ + return frappe.get_list("Assessment Evaluation Criteria", \ + fields=["evaluation_criteria", "maximum_score"], filters={"parent": assessment}, order_by= "idx") + + +@frappe.whitelist() +def get_grade(grading_scale, percentage): + """Returns Grade based on the Grading Scale and Score. + + :param Grading Scale: Grading Scale + :param Percentage: Score Percentage Percentage + """ + grading_scale_intervals = {} + for d in frappe.get_all("Grading Scale Interval", fields=["grade_code", "min_score"], filters={"parent": grading_scale}): + grading_scale_intervals.update({d.min_score:d.grade_code}) + intervals = sorted(grading_scale_intervals.keys(), key=float, reverse=True) + for interval in intervals: + if flt(percentage) >= interval: + grade = grading_scale_intervals.get(interval) + break + else: + grade = "Unsuccessful" + return grade \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment/assessment.js b/erpnext/schools/doctype/assessment/assessment.js index e842f41337..5744982e31 100644 --- a/erpnext/schools/doctype/assessment/assessment.js +++ b/erpnext/schools/doctype/assessment/assessment.js @@ -4,48 +4,32 @@ cur_frm.add_fetch("student_group", "course", "course"); cur_frm.add_fetch("examiner", "instructor_name", "examiner_name"); cur_frm.add_fetch("supervisor", "instructor_name", "supervisor_name"); -cur_frm.add_fetch("student", "title", "student_name"); frappe.ui.form.on("Assessment", { - student_group: function(frm) { - frm.set_value("results", ""); - if (frm.doc.student_group) { + course: function(frm) { + if (frm.doc.course && frm.doc.maximum_assessment_score) { frappe.call({ - method: "erpnext.schools.api.get_student_group_students", + method: "erpnext.schools.api.get_evaluation_criterias", args: { - "student_group": frm.doc.student_group + course: frm.doc.course }, callback: function(r) { if (r.message) { + frm.doc.evaluation_criterias = []; $.each(r.message, function(i, d) { - var row = frappe.model.add_child(cur_frm.doc, "Assessment Result", "results"); - row.student = d.student; - row.student_name = d.student_name; + var row = frappe.model.add_child(frm.doc, "Assessment Evaluation Criteria", "evaluation_criterias"); + row.evaluation_criteria = d.evaluation_criteria; + row.maximum_score = d.weightage / 100 * frm.doc.maximum_assessment_score; }); } - refresh_field("results"); - } - }); - } - } -}); + refresh_field("evaluation_criterias"); -frappe.ui.form.on("Assessment Result", { - result: function(frm, cdt, cdn) { - if (frm.doc.grading_structure) { - var assessment_result = locals[cdt][cdn]; - frappe.call({ - method: "erpnext.schools.doctype.assessment.assessment.get_grade", - args: { - grading_structure: frm.doc.grading_structure, - result: assessment_result.result - }, - callback: function(r) { - if (r.message) { - frappe.model.set_value(cdt, cdn, 'grade', r.message); - } } }); } + }, + + maximum_assessment_score: function(frm) { + frm.trigger("course"); } }); \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment/assessment.json b/erpnext/schools/doctype/assessment/assessment.json index 845f2f6500..0b46abc912 100644 --- a/erpnext/schools/doctype/assessment/assessment.json +++ b/erpnext/schools/doctype/assessment/assessment.json @@ -131,18 +131,18 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "grading_structure", + "fieldname": "examiner", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "in_standard_filter": 1, - "label": "Grading Structure", + "in_standard_filter": 0, + "label": "Examiner", "length": 0, "no_copy": 0, - "options": "Grading Structure", + "options": "Instructor", "permlevel": 0, "precision": "", "print_hide": 0, @@ -160,18 +160,17 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "course", - "fieldtype": "Link", + "fieldname": "examiner_name", + "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, - "in_standard_filter": 1, - "label": "Course", + "in_standard_filter": 0, + "label": "Examiner Name", "length": 0, "no_copy": 0, - "options": "Course", "permlevel": 0, "precision": "", "print_hide": 0, @@ -179,7 +178,7 @@ "read_only": 1, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -211,6 +210,35 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "course", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Course", + "length": 0, + "no_copy": 0, + "options": "Course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -240,6 +268,63 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "maximum_assessment_score", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Maximum Assessment Score", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "grading_scale", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Grading Scale", + "length": 0, + "no_copy": 0, + "options": "Grading Scale", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -301,63 +386,6 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "columns": 0, - "fieldname": "examiner", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Examiner", - "length": 0, - "no_copy": 0, - "options": "Instructor", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "examiner_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Examiner Name", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, "collapsible_depends_on": "", "columns": 0, "depends_on": "", @@ -528,9 +556,9 @@ { "allow_on_submit": 0, "bold": 0, - "collapsible": 1, + "collapsible": 0, "columns": 0, - "fieldname": "section_break_11", + "fieldname": "section_break_20", "fieldtype": "Section Break", "hidden": 0, "ignore_user_permissions": 0, @@ -538,7 +566,6 @@ "in_filter": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Results", "length": 0, "no_copy": 0, "permlevel": 0, @@ -558,7 +585,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "results", + "fieldname": "evaluation_criterias", "fieldtype": "Table", "hidden": 0, "ignore_user_permissions": 0, @@ -566,10 +593,10 @@ "in_filter": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "results", + "label": "Evaluation Criterias", "length": 0, "no_copy": 0, - "options": "Assessment Result", + "options": "Assessment Evaluation Criteria", "permlevel": 0, "precision": "", "print_hide": 0, @@ -577,7 +604,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -622,7 +649,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2016-11-16 13:05:54.953750", + "modified": "2016-12-15 14:35:50.780052", "modified_by": "Administrator", "module": "Schools", "name": "Assessment", diff --git a/erpnext/schools/doctype/assessment/assessment.py b/erpnext/schools/doctype/assessment/assessment.py index 003b4276e7..1ea1577957 100644 --- a/erpnext/schools/doctype/assessment/assessment.py +++ b/erpnext/schools/doctype/assessment/assessment.py @@ -34,7 +34,7 @@ class Assessment(Document): validate_overlap_for(self, "Assessment", "student_group") validate_overlap_for(self, "Assessment", "room") - validate_overlap_for(self, "Assessment", "supervisor", self.instructor) + validate_overlap_for(self, "Assessment", "supervisor", self.supervisor) def get_assessment_list(doctype, txt, filters, limit_start, limit_page_length=20): @@ -53,21 +53,4 @@ def get_list_context(context=None): "title": _("Assessment Schedule"), "get_list": get_assessment_list, "row_template": "templates/includes/assessment/assessment_row.html" - } - -@frappe.whitelist() -def get_grade(grading_structure, result): - grade = frappe.db.sql("""select gi.from_score, gi.to_score, gi.grade_code, gi.grade_description - from `tabGrading Structure` as gs, `tabGrade Interval` as gi - where gs.name = gi.parent and gs.name = %(grading_structure)s and gi.from_score <= %(result)s - and gi.to_score >= %(result)s""".format(), - { - "grading_structure":grading_structure, - "result": result - }, - as_dict=True) - - return grade[0].grade_code if grade else "" - -def validate_grade(score, grade): - pass \ No newline at end of file + } \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment_evaluation_criteria/__init__.py b/erpnext/schools/doctype/assessment_evaluation_criteria/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/assessment_evaluation_criteria/assessment_evaluation_criteria.json b/erpnext/schools/doctype/assessment_evaluation_criteria/assessment_evaluation_criteria.json new file mode 100644 index 0000000000..870aaa0354 --- /dev/null +++ b/erpnext/schools/doctype/assessment_evaluation_criteria/assessment_evaluation_criteria.json @@ -0,0 +1,124 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "", + "beta": 0, + "creation": "2016-12-14 17:20:27.738226", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "evaluation_criteria", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Evaluation Criteria", + "length": 0, + "no_copy": 0, + "options": "Evaluation Criteria", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_2", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "maximum_score", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Maximum Score", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2016-12-14 17:31:11.950549", + "modified_by": "Administrator", + "module": "Schools", + "name": "Assessment Evaluation Criteria", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment_evaluation_criteria/assessment_evaluation_criteria.py b/erpnext/schools/doctype/assessment_evaluation_criteria/assessment_evaluation_criteria.py new file mode 100644 index 0000000000..08f6fd4b9a --- /dev/null +++ b/erpnext/schools/doctype/assessment_evaluation_criteria/assessment_evaluation_criteria.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class AssessmentEvaluationCriteria(Document): + pass diff --git a/erpnext/schools/doctype/assessment_result/assessment_result.js b/erpnext/schools/doctype/assessment_result/assessment_result.js new file mode 100644 index 0000000000..3bb6105806 --- /dev/null +++ b/erpnext/schools/doctype/assessment_result/assessment_result.js @@ -0,0 +1,51 @@ +// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +cur_frm.add_fetch("student", "title", "student_name"); +cur_frm.add_fetch("assessment", "grading_scale", "grading_scale"); +cur_frm.add_fetch("assessment", "maximum_assessment_score", "maximum_score"); + +frappe.ui.form.on("Assessment Result", { + assessment: function(frm) { + frappe.call({ + method: "erpnext.schools.api.get_assessment_details", + args: { + assessment: frm.doc.assessment + }, + callback: function(r) { + if (r.message) { + frm.doc.details = []; + $.each(r.message, function(i, d) { + var row = frappe.model.add_child(frm.doc, "Assessment Result Detail", "details"); + row.evaluation_criteria = d.evaluation_criteria; + row.maximum_score = d.maximum_score; + }); + } + refresh_field("details"); + } + }); + } +}); + +frappe.ui.form.on("Assessment Result Detail", { + score: function(frm, cdt, cdn) { + var d = locals[cdt][cdn]; + if (d.score >= d.maximum_score) { + frappe.throw(_("Score cannot be greater than Maximum Score")); + } + else { + frappe.call({ + method: "erpnext.schools.api.get_grade", + args: { + grading_scale: frm.doc.grading_scale, + percentage: ((d.score/d.maximum_score) * 100) + }, + callback: function(r) { + if (r.message) { + frappe.model.set_value(cdt, cdn, "grade", r.message); + } + } + }); + } + } +}); \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment_result/assessment_result.json b/erpnext/schools/doctype/assessment_result/assessment_result.json index 91e580d40b..e76b7b9c88 100644 --- a/erpnext/schools/doctype/assessment_result/assessment_result.json +++ b/erpnext/schools/doctype/assessment_result/assessment_result.json @@ -2,6 +2,7 @@ "allow_copy": 0, "allow_import": 0, "allow_rename": 0, + "autoname": "RES.######", "beta": 0, "creation": "2015-11-13 17:18:06.468332", "custom": 0, @@ -9,18 +10,21 @@ "doctype": "DocType", "document_type": "", "editable_grid": 1, + "engine": "InnoDB", "fields": [ { "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "student", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, - "in_list_view": 1, + "in_list_view": 0, + "in_standard_filter": 0, "label": "Student", "length": 0, "no_copy": 0, @@ -30,6 +34,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -40,6 +45,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "student_name", "fieldtype": "Data", "hidden": 0, @@ -47,6 +53,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Student Name", "length": 0, "no_copy": 0, @@ -55,6 +62,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -65,6 +73,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "column_break_3", "fieldtype": "Column Break", "hidden": 0, @@ -72,6 +81,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -79,6 +89,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -89,21 +100,54 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "fieldname": "result", - "fieldtype": "Data", + "columns": 0, + "fieldname": "assessment", + "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, - "label": "Result", + "in_standard_filter": 0, + "label": "Assessment", "length": 0, "no_copy": 0, + "options": "Assessment", "permlevel": 0, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "grading_scale", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Grading Scale", + "length": 0, + "no_copy": 0, + "options": "Grading Scale", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -114,6 +158,174 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "", + "fieldname": "details", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Details", + "length": 0, + "no_copy": 0, + "options": "Assessment Result Detail", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_8", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "maximum_score", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Maximum Score", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "total_score", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Total Score", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_11", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, "fieldname": "grade", "fieldtype": "Data", "hidden": 0, @@ -121,6 +333,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Grade", "length": 0, "no_copy": 0, @@ -129,6 +342,35 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Assessment Result", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -142,21 +384,44 @@ "image_view": 0, "in_create": 0, "in_dialog": 0, - "is_submittable": 0, + "is_submittable": 1, "issingle": 0, - "istable": 1, + "istable": 0, "max_attachments": 0, - "modified": "2016-08-27 12:15:01.923000", + "modified": "2016-12-27 17:05:36.436123", "modified_by": "Administrator", "module": "Schools", "name": "Assessment Result", "name_case": "", "owner": "Administrator", - "permissions": [], + "permissions": [ + { + "amend": 1, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], "quick_entry": 0, "read_only": 0, "read_only_onload": 0, "sort_field": "modified", "sort_order": "DESC", + "title_field": "student_name", "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment_result/assessment_result.py b/erpnext/schools/doctype/assessment_result/assessment_result.py index 84cbcfa43b..0afd4b9fbf 100644 --- a/erpnext/schools/doctype/assessment_result/assessment_result.py +++ b/erpnext/schools/doctype/assessment_result/assessment_result.py @@ -4,7 +4,22 @@ from __future__ import unicode_literals import frappe +from frappe.utils import flt from frappe.model.document import Document +from erpnext.schools.api import get_grade class AssessmentResult(Document): - pass + def validate(self): + self.maximum_score = frappe.db.get_value("Assessment", self.assessment, "maximum_assessment_score") + self.validate_grade() + + def validate_grade(self): + self.total_score = 0.0 + for d in self.details: + if d.score > d.maximum_score: + frappe.throw(_("Score cannot be greater than Maximum Score")) + else: + d.grade = get_grade(self.grading_scale, (flt(d.score)/d.maximum_score)*100) + self.total_score += d.score + self.grade = get_grade(self.grading_scale, (self.total_score/self.maximum_score)*100) + \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment_result/test_assessment_result.py b/erpnext/schools/doctype/assessment_result/test_assessment_result.py new file mode 100644 index 0000000000..a889be0c26 --- /dev/null +++ b/erpnext/schools/doctype/assessment_result/test_assessment_result.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Assessment Result') + +class TestAssessmentResult(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/assessment_result_detail/__init__.py b/erpnext/schools/doctype/assessment_result_detail/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/assessment_result_detail/assessment_result_detail.json b/erpnext/schools/doctype/assessment_result_detail/assessment_result_detail.json new file mode 100644 index 0000000000..87ce1207cf --- /dev/null +++ b/erpnext/schools/doctype/assessment_result_detail/assessment_result_detail.json @@ -0,0 +1,180 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "", + "beta": 0, + "creation": "2016-12-14 17:44:35.583123", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 4, + "fieldname": "evaluation_criteria", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Evaluation Criteria", + "length": 0, + "no_copy": 0, + "options": "Evaluation Criteria", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 2, + "fieldname": "maximum_score", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Maximum Score", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_2", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 2, + "fieldname": "score", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Score", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 2, + "fieldname": "grade", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Grade", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2016-12-27 16:18:12.022257", + "modified_by": "Administrator", + "module": "Schools", + "name": "Assessment Result Detail", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment_result_detail/assessment_result_detail.py b/erpnext/schools/doctype/assessment_result_detail/assessment_result_detail.py new file mode 100644 index 0000000000..d051593159 --- /dev/null +++ b/erpnext/schools/doctype/assessment_result_detail/assessment_result_detail.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class AssessmentResultDetail(Document): + pass diff --git a/erpnext/schools/doctype/course/course.json b/erpnext/schools/doctype/course/course.json index 6fada19b3c..3f166195d5 100644 --- a/erpnext/schools/doctype/course/course.json +++ b/erpnext/schools/doctype/course/course.json @@ -1,278 +1,362 @@ { - "allow_copy": 0, - "allow_import": 1, - "allow_rename": 1, - "autoname": "field:course_name", - "beta": 0, - "creation": "2015-09-07 12:39:55.181893", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 0, - "engine": "InnoDB", - "fields": [ - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "course_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Course Name", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "course_code", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Course Code", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_3", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "course_abbreviation", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Course Abbreviation", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "department", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Department", - "length": 0, - "no_copy": 0, - "options": "Department", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_6", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "course_intro", - "fieldtype": "Text Editor", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Course Intro", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - } - ], - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "in_dialog": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "menu_index": 0, - "modified": "2016-08-08 05:26:26.442635", - "modified_by": "Administrator", - "module": "Schools", - "name": "Course", - "name_case": "", - "owner": "Administrator", - "permissions": [ - { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "is_custom": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Academics User", - "set_user_permissions": 0, - "share": 1, - "submit": 0, - "write": 1 - }, - { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "HR Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 0, - "write": 1 - } - ], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "search_fields": "department", - "sort_field": "modified", - "sort_order": "DESC", - "track_seen": 0 + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 1, + "autoname": "field:course_name", + "beta": 0, + "creation": "2015-09-07 12:39:55.181893", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 0, + "engine": "InnoDB", + "fields": [{ + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "course_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Course Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "course_code", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Course Code", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "course_abbreviation", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Course Abbreviation", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "department", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Department", + "length": 0, + "no_copy": 0, + "options": "Department", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_6", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "course_intro", + "fieldtype": "Text Editor", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Course Intro", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "assessment", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Assessment", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "default_grading_scale", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Default Grading Scale", + "length": 0, + "no_copy": 0, + "options": "Grading Scale", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "evaluation_criterias", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Evaluation Criterias", + "length": 0, + "no_copy": 0, + "options": "Course Evaluation Criteria", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "menu_index": 0, + "modified": "2016-12-14 16:48:16.642813", + "modified_by": "Administrator", + "module": "Schools", + "name": "Course", + "name_case": "", + "owner": "Administrator", + "permissions": [{ + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "HR Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "department", + "sort_field": "modified", + "sort_order": "DESC", + "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/schools/doctype/course/course.py b/erpnext/schools/doctype/course/course.py index b590acb52a..c2b368d28f 100644 --- a/erpnext/schools/doctype/course/course.py +++ b/erpnext/schools/doctype/course/course.py @@ -8,7 +8,16 @@ from frappe.model.document import Document from frappe import _ class Course(Document): - pass + def validate(self): + self.validate_evaluation_criterias() + + def validate_evaluation_criterias(self): + if self.evaluation_criterias: + total_weightage = 0 + for criteria in self.evaluation_criterias: + total_weightage += criteria.weightage + if total_weightage != 100: + frappe.throw(_("Total Weightage of all Evaluation Criterias must be 100%")) def get_sg_list(doctype, txt, filters, limit_start, limit_page_length=20): user = frappe.session.user diff --git a/erpnext/schools/doctype/course_evaluation_criteria/__init__.py b/erpnext/schools/doctype/course_evaluation_criteria/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/course_evaluation_criteria/course_evaluation_criteria.json b/erpnext/schools/doctype/course_evaluation_criteria/course_evaluation_criteria.json new file mode 100644 index 0000000000..a4d3ce404e --- /dev/null +++ b/erpnext/schools/doctype/course_evaluation_criteria/course_evaluation_criteria.json @@ -0,0 +1,124 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "", + "beta": 0, + "creation": "2016-12-14 16:46:46.786353", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "evaluation_criteria", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Evaluation Criteria", + "length": 0, + "no_copy": 0, + "options": "Evaluation Criteria", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_2", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "weightage", + "fieldtype": "Percent", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Weightage", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2016-12-14 16:59:17.353023", + "modified_by": "Administrator", + "module": "Schools", + "name": "Course Evaluation Criteria", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/course_evaluation_criteria/course_evaluation_criteria.py b/erpnext/schools/doctype/course_evaluation_criteria/course_evaluation_criteria.py new file mode 100644 index 0000000000..b8398a3012 --- /dev/null +++ b/erpnext/schools/doctype/course_evaluation_criteria/course_evaluation_criteria.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class CourseEvaluationCriteria(Document): + pass diff --git a/erpnext/schools/doctype/evaluation_criteria/__init__.py b/erpnext/schools/doctype/evaluation_criteria/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/evaluation_criteria/evaluation_criteria.js b/erpnext/schools/doctype/evaluation_criteria/evaluation_criteria.js new file mode 100644 index 0000000000..5e0269b1fd --- /dev/null +++ b/erpnext/schools/doctype/evaluation_criteria/evaluation_criteria.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Evaluation Criteria', { + refresh: function(frm) { + + } +}); diff --git a/erpnext/schools/doctype/evaluation_criteria/evaluation_criteria.json b/erpnext/schools/doctype/evaluation_criteria/evaluation_criteria.json new file mode 100644 index 0000000000..f830abe5b1 --- /dev/null +++ b/erpnext/schools/doctype/evaluation_criteria/evaluation_criteria.json @@ -0,0 +1,89 @@ +{ + "allow_copy": 0, + "allow_import": 1, + "allow_rename": 0, + "autoname": "field:evaluation_criteria", + "beta": 0, + "creation": "2016-12-14 16:40:15.144115", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "evaluation_criteria", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Evaluation Criteria", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2016-12-14 16:40:36.351183", + "modified_by": "Administrator", + "module": "Schools", + "name": "Evaluation Criteria", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/evaluation_criteria/evaluation_criteria.py b/erpnext/schools/doctype/evaluation_criteria/evaluation_criteria.py new file mode 100644 index 0000000000..85c1b32aaa --- /dev/null +++ b/erpnext/schools/doctype/evaluation_criteria/evaluation_criteria.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class EvaluationCriteria(Document): + pass diff --git a/erpnext/schools/doctype/evaluation_criteria/test_evaluation_criteria.py b/erpnext/schools/doctype/evaluation_criteria/test_evaluation_criteria.py new file mode 100644 index 0000000000..0182db6b0e --- /dev/null +++ b/erpnext/schools/doctype/evaluation_criteria/test_evaluation_criteria.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Evaluation Criteria') + +class TestEvaluationCriteria(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/grade_interval/grade_interval.json b/erpnext/schools/doctype/grade_interval/grade_interval.json index 79ef9f40a6..c9c59495d9 100644 --- a/erpnext/schools/doctype/grade_interval/grade_interval.json +++ b/erpnext/schools/doctype/grade_interval/grade_interval.json @@ -9,11 +9,13 @@ "doctype": "DocType", "document_type": "", "editable_grid": 1, + "engine": "InnoDB", "fields": [ { "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "grade_code", "fieldtype": "Data", "hidden": 0, @@ -21,6 +23,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Grade Code", "length": 0, "no_copy": 0, @@ -29,6 +32,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -39,39 +43,16 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "fieldname": "from_score", - "fieldtype": "Float", + "columns": 0, + "fieldname": "min_score", + "fieldtype": "Percent", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, - "label": "From Score", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "1", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "to_score", - "fieldtype": "Float", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "To Score", + "in_standard_filter": 0, + "label": "Min Score", "length": 0, "no_copy": 0, "permlevel": 0, @@ -79,6 +60,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -89,6 +71,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "grade_description", "fieldtype": "Small Text", "hidden": 0, @@ -96,6 +79,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Grade Description", "length": 0, "no_copy": 0, @@ -104,6 +88,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -121,7 +106,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-08-27 15:45:04.657328", + "modified": "2016-12-14 12:54:56.902465", "modified_by": "Administrator", "module": "Schools", "name": "Grade Interval", diff --git a/erpnext/schools/doctype/grading_scale/__init__.py b/erpnext/schools/doctype/grading_scale/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/grading_scale/grading_scale.js b/erpnext/schools/doctype/grading_scale/grading_scale.js new file mode 100644 index 0000000000..622388c0b1 --- /dev/null +++ b/erpnext/schools/doctype/grading_scale/grading_scale.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Grading Scale', { + refresh: function(frm) { + + } +}); diff --git a/erpnext/schools/doctype/grading_scale/grading_scale.json b/erpnext/schools/doctype/grading_scale/grading_scale.json new file mode 100644 index 0000000000..99c6948061 --- /dev/null +++ b/erpnext/schools/doctype/grading_scale/grading_scale.json @@ -0,0 +1,203 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 1, + "autoname": "field:grading_scale_name", + "beta": 0, + "creation": "2016-08-26 03:06:53.922972", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "grading_scale_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Grading Scale Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "description", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "grading_intervals_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Grading Scale Intervals", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "intervals", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Intervals", + "length": 0, + "no_copy": 0, + "options": "Grading Scale Interval", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Grading Scale", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2016-12-14 14:35:22.907023", + "modified_by": "Administrator", + "module": "Schools", + "name": "Grading Scale", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/grading_scale/grading_scale.py b/erpnext/schools/doctype/grading_scale/grading_scale.py new file mode 100644 index 0000000000..8e66f1a2d4 --- /dev/null +++ b/erpnext/schools/doctype/grading_scale/grading_scale.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class GradingScale(Document): + pass diff --git a/erpnext/schools/doctype/grading_scale/test_grading_scale.py b/erpnext/schools/doctype/grading_scale/test_grading_scale.py new file mode 100644 index 0000000000..5364d7c887 --- /dev/null +++ b/erpnext/schools/doctype/grading_scale/test_grading_scale.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Grading Scale') + +class TestGradingScale(unittest.TestCase): + pass diff --git a/erpnext/schools/doctype/grading_scale_interval/__init__.py b/erpnext/schools/doctype/grading_scale_interval/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json b/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json new file mode 100644 index 0000000000..bf7d3066c8 --- /dev/null +++ b/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json @@ -0,0 +1,123 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2016-08-26 03:11:09.591049", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "grade_code", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Grade Code", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "0", + "fieldname": "min_score", + "fieldtype": "Percent", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Min Score", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "1", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "grade_description", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Grade Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2016-12-14 14:32:52.892711", + "modified_by": "Administrator", + "module": "Schools", + "name": "Grading Scale Interval", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.py b/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.py new file mode 100644 index 0000000000..41ac5ffd5c --- /dev/null +++ b/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class GradingScaleInterval(Document): + pass diff --git a/erpnext/schools/doctype/grading_structure/grading_structure.json b/erpnext/schools/doctype/grading_structure/grading_structure.json index cda6bd4e4f..3c30f299d2 100644 --- a/erpnext/schools/doctype/grading_structure/grading_structure.json +++ b/erpnext/schools/doctype/grading_structure/grading_structure.json @@ -10,11 +10,13 @@ "doctype": "DocType", "document_type": "", "editable_grid": 1, + "engine": "InnoDB", "fields": [ { "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "grading_system_name", "fieldtype": "Data", "hidden": 0, @@ -22,6 +24,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Grading System Name", "length": 0, "no_copy": 0, @@ -30,6 +33,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -40,6 +44,34 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, + "fieldname": "column_break_2", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, "fieldname": "description", "fieldtype": "Text", "hidden": 0, @@ -47,6 +79,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Description", "length": 0, "no_copy": 0, @@ -55,6 +88,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -65,30 +99,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, - "fieldname": "column_break_3", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, + "columns": 0, "fieldname": "grading_intervals_section", "fieldtype": "Section Break", "hidden": 0, @@ -96,6 +107,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Grading Intervals", "length": 0, "no_copy": 0, @@ -104,6 +116,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -114,6 +127,7 @@ "allow_on_submit": 0, "bold": 0, "collapsible": 0, + "columns": 0, "fieldname": "grade_intervals", "fieldtype": "Table", "hidden": 0, @@ -121,6 +135,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Grade Intervals", "length": 0, "no_copy": 0, @@ -130,6 +145,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -147,7 +163,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-08-27 14:20:50.709823", + "modified": "2016-12-14 12:35:39.690256", "modified_by": "Administrator", "module": "Schools", "name": "Grading Structure", @@ -164,6 +180,7 @@ "export": 1, "if_owner": 0, "import": 0, + "is_custom": 0, "permlevel": 0, "print": 1, "read": 1, diff --git a/erpnext/schools/doctype/student/student_dashboard.py b/erpnext/schools/doctype/student/student_dashboard.py index 8b5fb41365..ca2a660292 100644 --- a/erpnext/schools/doctype/student/student_dashboard.py +++ b/erpnext/schools/doctype/student/student_dashboard.py @@ -10,7 +10,7 @@ def get_data(): 'items': ['Student Log', 'Student Batch', 'Student Group', 'Program Enrollment'] }, { - 'items': ['Fees', 'Assessment', 'Student Attendance', 'Student Leave Application'] + 'items': ['Fees', 'Assessment Result', 'Student Attendance', 'Student Leave Application'] } ] } \ No newline at end of file From 5c8745591854381650923eef3535f3ce7055ab00 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Thu, 29 Dec 2016 17:05:29 +0530 Subject: [PATCH 2/7] Patch for assessment module redesign --- erpnext/patches.txt | 2 ++ .../patches/v7_2/update_assessment_modules.py | 29 +++++++++++++++++++ .../grading_scale_interval.json | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/v7_2/update_assessment_modules.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index ef1e2c12a9..1221a4f230 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -360,3 +360,5 @@ erpnext.patches.v7_1.set_sales_person_status erpnext.patches.v7_1.repost_stock_for_deleted_bins_for_merging_items execute:frappe.delete_doc('Desktop Icon', {'module_name': 'Profit and Loss Statment'}) erpnext.patches.v7_2.update_website_for_variant +erpnext.patches.v7_2.update_assessment_modules + diff --git a/erpnext/patches/v7_2/update_assessment_modules.py b/erpnext/patches/v7_2/update_assessment_modules.py new file mode 100644 index 0000000000..da0c54c4c7 --- /dev/null +++ b/erpnext/patches/v7_2/update_assessment_modules.py @@ -0,0 +1,29 @@ +import frappe +from frappe.model.utils.rename_field import rename_field + +def execute(): + #Rename Grading Structure to Grading Scale + frappe.rename_doc("DocType", "Grading Structure", "Grading Scale", force=True) + frappe.rename_doc("DocType", "Grade Interval", "Grading Scale Interval", force=True) + + frappe.reload_doc("schools", "doctype", "grading_scale_interval") + rename_field("Grading Scale Interval", "to_score", "min_score") + + #Rename Assessment Results + frappe.reload_doc("schools", "doctype", "assessment") + rename_field("Assessment", "grading_structure", "grading_scale") + + frappe.reload_doc("schools", "doctype", "assessment_result") + for assessment in frappe.get_all("Assessment", fields=["name", "grading_scale"]): + for stud_result in frappe.db.sql("select * from `tabAssessment Result` where parent= %s", assessment.name, as_dict=True): + if stud_result.result: + assessment_result = frappe.new_doc("Assessment Result") + assessment_result.student = stud_result.student + assessment_result.student_name = stud_result.student_name + assessment_result.assessment = assessment.name + assessment_result.grading_scale = assessment.grading_scale + assessment_result.total_score = stud_result.result + assessment_result.flags.ignore_validate = True + assessment_result.save() + + frappe.db.sql("""delete from `tabAssessment Result` where parent != '' or parent is not null""") \ No newline at end of file diff --git a/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json b/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json index bf7d3066c8..87cdeec841 100644 --- a/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json +++ b/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json @@ -107,7 +107,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-12-14 14:32:52.892711", + "modified": "2016-12-29 17:10:26.153591", "modified_by": "Administrator", "module": "Schools", "name": "Grading Scale Interval", From 577cfd559f9a8cbf140eee5e10098d61c8c2d18f Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Fri, 30 Dec 2016 16:58:46 +0530 Subject: [PATCH 3/7] Removed LMS code in Course master --- erpnext/hooks.py | 1 - erpnext/schools/doctype/course/course.py | 17 ----------------- 2 files changed, 18 deletions(-) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 95f6c0b5c4..0093375243 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -108,7 +108,6 @@ portal_menu_items = [ {"title": _("Issues"), "route": "/issues", "reference_doctype": "Issue", "role":"Customer"}, {"title": _("Addresses"), "route": "/addresses", "reference_doctype": "Address"}, {"title": _("Announcements"), "route": "/announcement", "reference_doctype": "Announcement"}, - {"title": _("Courses"), "route": "/course", "reference_doctype": "Course", "role":"Student"}, {"title": _("Assessment Schedule"), "route": "/assessment", "reference_doctype": "Assessment", "role":"Student"}, {"title": _("Fees"), "route": "/fees", "reference_doctype": "Fees", "role":"Student"} ] diff --git a/erpnext/schools/doctype/course/course.py b/erpnext/schools/doctype/course/course.py index c2b368d28f..3baccdfca0 100644 --- a/erpnext/schools/doctype/course/course.py +++ b/erpnext/schools/doctype/course/course.py @@ -18,20 +18,3 @@ class Course(Document): total_weightage += criteria.weightage if total_weightage != 100: frappe.throw(_("Total Weightage of all Evaluation Criterias must be 100%")) - -def get_sg_list(doctype, txt, filters, limit_start, limit_page_length=20): - user = frappe.session.user - student = frappe.db.sql("select name from `tabStudent` where student_email_id= %s", user) - if student: - return frappe.db.sql('''select course, academic_term, academic_year, SG.name from `tabStudent Group` - as SG, `tabStudent Group Student` as SGS where SG.name = SGS.parent and SGS.student = %s - order by SG.name asc limit {0} , {1}'''.format(limit_start, limit_page_length), student, as_dict=True) - -def get_list_context(context=None): - return { - "show_sidebar": True, - 'no_breadcrumbs': True, - "title": _("Courses"), - "get_list": get_sg_list, - "row_template": "templates/includes/course/course_row.html" - } \ No newline at end of file From 233ecfdd9cc296dd025c18add3227a78e7291c11 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 4 Jan 2017 15:41:38 +0530 Subject: [PATCH 4/7] Renamed min_score to threshold in Grading Scale --- erpnext/patches/v7_2/update_assessment_modules.py | 2 +- erpnext/schools/api.py | 4 ++-- .../grading_scale_interval/grading_scale_interval.json | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/erpnext/patches/v7_2/update_assessment_modules.py b/erpnext/patches/v7_2/update_assessment_modules.py index da0c54c4c7..a8ee865ec6 100644 --- a/erpnext/patches/v7_2/update_assessment_modules.py +++ b/erpnext/patches/v7_2/update_assessment_modules.py @@ -7,7 +7,7 @@ def execute(): frappe.rename_doc("DocType", "Grade Interval", "Grading Scale Interval", force=True) frappe.reload_doc("schools", "doctype", "grading_scale_interval") - rename_field("Grading Scale Interval", "to_score", "min_score") + rename_field("Grading Scale Interval", "to_score", "threshold") #Rename Assessment Results frappe.reload_doc("schools", "doctype", "assessment") diff --git a/erpnext/schools/api.py b/erpnext/schools/api.py index a1e4a490b0..912a75dfc2 100644 --- a/erpnext/schools/api.py +++ b/erpnext/schools/api.py @@ -191,8 +191,8 @@ def get_grade(grading_scale, percentage): :param Percentage: Score Percentage Percentage """ grading_scale_intervals = {} - for d in frappe.get_all("Grading Scale Interval", fields=["grade_code", "min_score"], filters={"parent": grading_scale}): - grading_scale_intervals.update({d.min_score:d.grade_code}) + for d in frappe.get_all("Grading Scale Interval", fields=["grade_code", "threshold"], filters={"parent": grading_scale}): + grading_scale_intervals.update({d.threshold:d.grade_code}) intervals = sorted(grading_scale_intervals.keys(), key=float, reverse=True) for interval in intervals: if flt(percentage) >= interval: diff --git a/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json b/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json index 87cdeec841..10b229c8c0 100644 --- a/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json +++ b/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json @@ -45,7 +45,7 @@ "collapsible": 0, "columns": 0, "default": "0", - "fieldname": "min_score", + "fieldname": "threshold", "fieldtype": "Percent", "hidden": 0, "ignore_user_permissions": 0, @@ -53,7 +53,7 @@ "in_filter": 0, "in_list_view": 1, "in_standard_filter": 0, - "label": "Min Score", + "label": "Threshold", "length": 0, "no_copy": 0, "permlevel": 0, @@ -107,7 +107,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-12-29 17:10:26.153591", + "modified": "2017-01-04 15:27:56.729286", "modified_by": "Administrator", "module": "Schools", "name": "Grading Scale Interval", @@ -119,5 +119,6 @@ "read_only_onload": 0, "sort_field": "modified", "sort_order": "DESC", + "track_changes": 1, "track_seen": 0 } \ No newline at end of file From a56224c03a2c251a79cd237f27c97697c1e93cf1 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 4 Jan 2017 17:00:43 +0530 Subject: [PATCH 5/7] Rename Assessment to Assessment Plan --- erpnext/config/desktop.py | 8 +-- erpnext/config/schools.py | 2 +- erpnext/hooks.py | 1 - .../patches/v7_2/update_assessment_modules.py | 10 ++-- erpnext/schools/api.py | 8 +-- .../schools/doctype/assessment/assessment.py | 56 ------------------- .../__init__.py | 0 .../assessment_plan.js} | 2 +- .../assessment_plan.json} | 7 ++- .../assessment_plan/assessment_plan.py | 37 ++++++++++++ .../test_assessment_plan.py} | 4 +- .../assessment_result/assessment_result.js | 8 +-- .../assessment_result/assessment_result.json | 9 +-- .../assessment_result/assessment_result.py | 2 +- erpnext/schools/doctype/course/course.js | 4 +- .../course_schedule/course_schedule.py | 8 +-- .../doctype/student_group/student_group.js | 4 +- 17 files changed, 77 insertions(+), 93 deletions(-) delete mode 100644 erpnext/schools/doctype/assessment/assessment.py rename erpnext/schools/doctype/{assessment => assessment_plan}/__init__.py (100%) rename erpnext/schools/doctype/{assessment/assessment.js => assessment_plan/assessment_plan.js} (97%) rename erpnext/schools/doctype/{assessment/assessment.json => assessment_plan/assessment_plan.json} (99%) create mode 100644 erpnext/schools/doctype/assessment_plan/assessment_plan.py rename erpnext/schools/doctype/{assessment/test_assessment.py => assessment_plan/test_assessment_plan.py} (64%) diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py index 9397ffc726..38a584626c 100644 --- a/erpnext/config/desktop.py +++ b/erpnext/config/desktop.py @@ -229,12 +229,12 @@ def get_data(): "type": "list" }, { - "module_name": "Assessment", + "module_name": "Assessment Plan", "color": "#8a70be", "icon": "fa fa-file-text-alt", - "label": _("Assessment"), - "link": "List/Assessment", - "_doctype": "Assessment", + "label": _("Assessment Plan"), + "link": "List/Assessment Plan", + "_doctype": "Assessment Plan", "type": "list" }, { diff --git a/erpnext/config/schools.py b/erpnext/config/schools.py index 581b520abe..cac6cfa27e 100644 --- a/erpnext/config/schools.py +++ b/erpnext/config/schools.py @@ -112,7 +112,7 @@ def get_data(): "items": [ { "type": "doctype", - "name": "Assessment" + "name": "Assessment Plan" }, { "type": "doctype", diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 0093375243..0a07e76d89 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -108,7 +108,6 @@ portal_menu_items = [ {"title": _("Issues"), "route": "/issues", "reference_doctype": "Issue", "role":"Customer"}, {"title": _("Addresses"), "route": "/addresses", "reference_doctype": "Address"}, {"title": _("Announcements"), "route": "/announcement", "reference_doctype": "Announcement"}, - {"title": _("Assessment Schedule"), "route": "/assessment", "reference_doctype": "Assessment", "role":"Student"}, {"title": _("Fees"), "route": "/fees", "reference_doctype": "Fees", "role":"Student"} ] diff --git a/erpnext/patches/v7_2/update_assessment_modules.py b/erpnext/patches/v7_2/update_assessment_modules.py index a8ee865ec6..43c5764505 100644 --- a/erpnext/patches/v7_2/update_assessment_modules.py +++ b/erpnext/patches/v7_2/update_assessment_modules.py @@ -9,18 +9,20 @@ def execute(): frappe.reload_doc("schools", "doctype", "grading_scale_interval") rename_field("Grading Scale Interval", "to_score", "threshold") + frappe.rename_doc("DocType", "Assessment", "Assessment Plan", force=True) + #Rename Assessment Results - frappe.reload_doc("schools", "doctype", "assessment") - rename_field("Assessment", "grading_structure", "grading_scale") + frappe.reload_doc("schools", "doctype", "assessment_plan") + rename_field("Assessment Plan", "grading_structure", "grading_scale") frappe.reload_doc("schools", "doctype", "assessment_result") - for assessment in frappe.get_all("Assessment", fields=["name", "grading_scale"]): + for assessment in frappe.get_all("Assessment Plan", fields=["name", "grading_scale"]): for stud_result in frappe.db.sql("select * from `tabAssessment Result` where parent= %s", assessment.name, as_dict=True): if stud_result.result: assessment_result = frappe.new_doc("Assessment Result") assessment_result.student = stud_result.student assessment_result.student_name = stud_result.student_name - assessment_result.assessment = assessment.name + assessment_result.assessment_plan = assessment.name assessment_result.grading_scale = assessment.grading_scale assessment_result.total_score = stud_result.result assessment_result.flags.ignore_validate = True diff --git a/erpnext/schools/api.py b/erpnext/schools/api.py index 912a75dfc2..e48748e621 100644 --- a/erpnext/schools/api.py +++ b/erpnext/schools/api.py @@ -174,13 +174,13 @@ def get_evaluation_criterias(course): fields=["evaluation_criteria", "weightage"], filters={"parent": course}, order_by= "idx") @frappe.whitelist() -def get_assessment_details(assessment): - """Returns Evaluation Criteria and Maximum Score from Assessment Master. +def get_assessment_details(assessment_plan): + """Returns Evaluation Criteria and Maximum Score from Assessment Plan Master. - :param Assessment: Assessment + :param Assessment Plan: Assessment Plan """ return frappe.get_list("Assessment Evaluation Criteria", \ - fields=["evaluation_criteria", "maximum_score"], filters={"parent": assessment}, order_by= "idx") + fields=["evaluation_criteria", "maximum_score"], filters={"parent": assessment_plan}, order_by= "idx") @frappe.whitelist() diff --git a/erpnext/schools/doctype/assessment/assessment.py b/erpnext/schools/doctype/assessment/assessment.py deleted file mode 100644 index 1ea1577957..0000000000 --- a/erpnext/schools/doctype/assessment/assessment.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -from frappe.model.document import Document -import frappe -from frappe import _ - -class Assessment(Document): - def validate(self): - self.validate_overlap() - - def validate_overlap(self): - """Validates overlap for Student Group/Student Batch, Instructor, Room""" - - from erpnext.schools.utils import validate_overlap_for - - #Validate overlapping course schedules. - if self.student_batch: - validate_overlap_for(self, "Course Schedule", "student_batch") - - if self.student_group: - validate_overlap_for(self, "Course Schedule", "student_group") - - validate_overlap_for(self, "Course Schedule", "instructor") - validate_overlap_for(self, "Course Schedule", "room") - - #validate overlapping assessment schedules. - if self.student_batch: - validate_overlap_for(self, "Assessment", "student_batch") - - if self.student_group: - validate_overlap_for(self, "Assessment", "student_group") - - validate_overlap_for(self, "Assessment", "room") - validate_overlap_for(self, "Assessment", "supervisor", self.supervisor) - - -def get_assessment_list(doctype, txt, filters, limit_start, limit_page_length=20): - user = frappe.session.user - student = frappe.db.sql("select name from `tabStudent` where student_email_id= %s", user) - if student: - return frappe. db.sql('''select course, schedule_date, from_time, to_time, sgs.name from `tabAssessment` as assessment, - `tabStudent Group Student` as sgs where assessment.student_group = sgs.parent and sgs.student = %s and assessment.docstatus=1 - order by assessment.name asc limit {0} , {1}''' - .format(limit_start, limit_page_length), student, as_dict = True) - -def get_list_context(context=None): - return { - "show_sidebar": True, - 'no_breadcrumbs': True, - "title": _("Assessment Schedule"), - "get_list": get_assessment_list, - "row_template": "templates/includes/assessment/assessment_row.html" - } \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment/__init__.py b/erpnext/schools/doctype/assessment_plan/__init__.py similarity index 100% rename from erpnext/schools/doctype/assessment/__init__.py rename to erpnext/schools/doctype/assessment_plan/__init__.py diff --git a/erpnext/schools/doctype/assessment/assessment.js b/erpnext/schools/doctype/assessment_plan/assessment_plan.js similarity index 97% rename from erpnext/schools/doctype/assessment/assessment.js rename to erpnext/schools/doctype/assessment_plan/assessment_plan.js index 5744982e31..7b746ffb77 100644 --- a/erpnext/schools/doctype/assessment/assessment.js +++ b/erpnext/schools/doctype/assessment_plan/assessment_plan.js @@ -5,7 +5,7 @@ cur_frm.add_fetch("student_group", "course", "course"); cur_frm.add_fetch("examiner", "instructor_name", "examiner_name"); cur_frm.add_fetch("supervisor", "instructor_name", "supervisor_name"); -frappe.ui.form.on("Assessment", { +frappe.ui.form.on("Assessment Plan", { course: function(frm) { if (frm.doc.course && frm.doc.maximum_assessment_score) { frappe.call({ diff --git a/erpnext/schools/doctype/assessment/assessment.json b/erpnext/schools/doctype/assessment_plan/assessment_plan.json similarity index 99% rename from erpnext/schools/doctype/assessment/assessment.json rename to erpnext/schools/doctype/assessment_plan/assessment_plan.json index 0b46abc912..10ae53c7bb 100644 --- a/erpnext/schools/doctype/assessment/assessment.json +++ b/erpnext/schools/doctype/assessment_plan/assessment_plan.json @@ -625,7 +625,7 @@ "label": "Amended From", "length": 0, "no_copy": 1, - "options": "Assessment", + "options": "Assessment Plan", "permlevel": 0, "print_hide": 1, "print_hide_if_no_value": 0, @@ -649,10 +649,10 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2016-12-15 14:35:50.780052", + "modified": "2017-01-04 16:21:40.752137", "modified_by": "Administrator", "module": "Schools", - "name": "Assessment", + "name": "Assessment Plan", "name_case": "", "owner": "Administrator", "permissions": [ @@ -683,5 +683,6 @@ "read_only_onload": 0, "sort_field": "modified", "sort_order": "DESC", + "track_changes": 0, "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment_plan/assessment_plan.py b/erpnext/schools/doctype/assessment_plan/assessment_plan.py new file mode 100644 index 0000000000..4c472fc87a --- /dev/null +++ b/erpnext/schools/doctype/assessment_plan/assessment_plan.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +from frappe.model.document import Document +import frappe +from frappe import _ + +class AssessmentPlan(Document): + def validate(self): + self.validate_overlap() + + def validate_overlap(self): + """Validates overlap for Student Group/Student Batch, Instructor, Room""" + + from erpnext.schools.utils import validate_overlap_for + + #Validate overlapping course schedules. + if self.student_batch: + validate_overlap_for(self, "Course Schedule", "student_batch") + + if self.student_group: + validate_overlap_for(self, "Course Schedule", "student_group") + + validate_overlap_for(self, "Course Schedule", "instructor") + validate_overlap_for(self, "Course Schedule", "room") + + #validate overlapping assessment schedules. + if self.student_batch: + validate_overlap_for(self, "Assessment Plan", "student_batch") + + if self.student_group: + validate_overlap_for(self, "Assessment Plan", "student_group") + + validate_overlap_for(self, "Assessment Plan", "room") + validate_overlap_for(self, "Assessment Plan", "supervisor", self.supervisor) diff --git a/erpnext/schools/doctype/assessment/test_assessment.py b/erpnext/schools/doctype/assessment_plan/test_assessment_plan.py similarity index 64% rename from erpnext/schools/doctype/assessment/test_assessment.py rename to erpnext/schools/doctype/assessment_plan/test_assessment_plan.py index ce060074a9..2de4f23f5b 100644 --- a/erpnext/schools/doctype/assessment/test_assessment.py +++ b/erpnext/schools/doctype/assessment_plan/test_assessment_plan.py @@ -6,7 +6,7 @@ from __future__ import unicode_literals import frappe import unittest -# test_records = frappe.get_test_records('Assessment') +# test_records = frappe.get_test_records('Assessment Plan') -class TestAssessment(unittest.TestCase): +class TestAssessmentPlan(unittest.TestCase): pass diff --git a/erpnext/schools/doctype/assessment_result/assessment_result.js b/erpnext/schools/doctype/assessment_result/assessment_result.js index 3bb6105806..265a626a80 100644 --- a/erpnext/schools/doctype/assessment_result/assessment_result.js +++ b/erpnext/schools/doctype/assessment_result/assessment_result.js @@ -2,15 +2,15 @@ // For license information, please see license.txt cur_frm.add_fetch("student", "title", "student_name"); -cur_frm.add_fetch("assessment", "grading_scale", "grading_scale"); -cur_frm.add_fetch("assessment", "maximum_assessment_score", "maximum_score"); +cur_frm.add_fetch("assessment_plan", "grading_scale", "grading_scale"); +cur_frm.add_fetch("assessment_plan", "maximum_assessment_score", "maximum_score"); frappe.ui.form.on("Assessment Result", { - assessment: function(frm) { + assessment_plan: function(frm) { frappe.call({ method: "erpnext.schools.api.get_assessment_details", args: { - assessment: frm.doc.assessment + assessment_plan: frm.doc.assessment_plan }, callback: function(r) { if (r.message) { diff --git a/erpnext/schools/doctype/assessment_result/assessment_result.json b/erpnext/schools/doctype/assessment_result/assessment_result.json index e76b7b9c88..3bf9758623 100644 --- a/erpnext/schools/doctype/assessment_result/assessment_result.json +++ b/erpnext/schools/doctype/assessment_result/assessment_result.json @@ -101,7 +101,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "assessment", + "fieldname": "assessment_plan", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, @@ -109,10 +109,10 @@ "in_filter": 0, "in_list_view": 1, "in_standard_filter": 0, - "label": "Assessment", + "label": "Assessment Plan", "length": 0, "no_copy": 0, - "options": "Assessment", + "options": "Assessment Plan", "permlevel": 0, "precision": "", "print_hide": 0, @@ -388,7 +388,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-12-27 17:05:36.436123", + "modified": "2017-01-04 16:56:33.868949", "modified_by": "Administrator", "module": "Schools", "name": "Assessment Result", @@ -423,5 +423,6 @@ "sort_field": "modified", "sort_order": "DESC", "title_field": "student_name", + "track_changes": 0, "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment_result/assessment_result.py b/erpnext/schools/doctype/assessment_result/assessment_result.py index 0afd4b9fbf..7ef3240180 100644 --- a/erpnext/schools/doctype/assessment_result/assessment_result.py +++ b/erpnext/schools/doctype/assessment_result/assessment_result.py @@ -10,7 +10,7 @@ from erpnext.schools.api import get_grade class AssessmentResult(Document): def validate(self): - self.maximum_score = frappe.db.get_value("Assessment", self.assessment, "maximum_assessment_score") + self.maximum_score = frappe.db.get_value("Assessment Plan", self.assessment_plan, "maximum_assessment_score") self.validate_grade() def validate_grade(self): diff --git a/erpnext/schools/doctype/course/course.js b/erpnext/schools/doctype/course/course.js index fe38806ff7..c667eca2b7 100644 --- a/erpnext/schools/doctype/course/course.js +++ b/erpnext/schools/doctype/course/course.js @@ -21,11 +21,11 @@ frappe.ui.form.on("Course", "refresh", function(frm) { frappe.set_route("List", "Course Schedule"); }); - frm.add_custom_button(__("Assessment"), function() { + frm.add_custom_button(__("Assessment Plan"), function() { frappe.route_options = { course: frm.doc.name } - frappe.set_route("List", "Assessment"); + frappe.set_route("List", "Assessment Plan"); }); } }); \ No newline at end of file diff --git a/erpnext/schools/doctype/course_schedule/course_schedule.py b/erpnext/schools/doctype/course_schedule/course_schedule.py index ec30c62140..7550ab1c47 100644 --- a/erpnext/schools/doctype/course_schedule/course_schedule.py +++ b/erpnext/schools/doctype/course_schedule/course_schedule.py @@ -55,11 +55,11 @@ class CourseSchedule(Document): #validate overlapping assessment schedules. if self.student_batch: - validate_overlap_for(self, "Assessment", "student_batch") + validate_overlap_for(self, "Assessment Plan", "student_batch") if self.student_group: - validate_overlap_for(self, "Assessment", "student_group") + validate_overlap_for(self, "Assessment Plan", "student_group") - validate_overlap_for(self, "Assessment", "room") - validate_overlap_for(self, "Assessment", "supervisor", self.instructor) + validate_overlap_for(self, "Assessment Plan", "room") + validate_overlap_for(self, "Assessment Plan", "supervisor", self.instructor) diff --git a/erpnext/schools/doctype/student_group/student_group.js b/erpnext/schools/doctype/student_group/student_group.js index 6f4084be25..392793a1f6 100644 --- a/erpnext/schools/doctype/student_group/student_group.js +++ b/erpnext/schools/doctype/student_group/student_group.js @@ -10,11 +10,11 @@ frappe.ui.form.on("Student Group", { frappe.set_route("List", "Course Schedule"); }); - frm.add_custom_button(__("Assessment"), function() { + frm.add_custom_button(__("Assessment Plan"), function() { frappe.route_options = { student_group: frm.doc.name } - frappe.set_route("List", "Assessment"); + frappe.set_route("List", "Assessment Plan"); }); } }, From 5a30467ae57f92a3d6e2e0cfbf860d4fa7e37d3c Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Wed, 4 Jan 2017 18:12:16 +0530 Subject: [PATCH 6/7] Added test case --- .../assessment_result/assessment_result.py | 1 - .../assessment_result/test_assessment_result.py | 9 ++++++++- .../doctype/evaluation_criteria/test_records.json | 8 ++++++++ .../doctype/grading_scale/test_records.json | 15 +++++++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 erpnext/schools/doctype/evaluation_criteria/test_records.json create mode 100644 erpnext/schools/doctype/grading_scale/test_records.json diff --git a/erpnext/schools/doctype/assessment_result/assessment_result.py b/erpnext/schools/doctype/assessment_result/assessment_result.py index 7ef3240180..d39f3ca67e 100644 --- a/erpnext/schools/doctype/assessment_result/assessment_result.py +++ b/erpnext/schools/doctype/assessment_result/assessment_result.py @@ -22,4 +22,3 @@ class AssessmentResult(Document): d.grade = get_grade(self.grading_scale, (flt(d.score)/d.maximum_score)*100) self.total_score += d.score self.grade = get_grade(self.grading_scale, (self.total_score/self.maximum_score)*100) - \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment_result/test_assessment_result.py b/erpnext/schools/doctype/assessment_result/test_assessment_result.py index a889be0c26..66e611c866 100644 --- a/erpnext/schools/doctype/assessment_result/test_assessment_result.py +++ b/erpnext/schools/doctype/assessment_result/test_assessment_result.py @@ -5,8 +5,15 @@ from __future__ import unicode_literals import frappe import unittest +from erpnext.schools.api import get_grade # test_records = frappe.get_test_records('Assessment Result') class TestAssessmentResult(unittest.TestCase): - pass + def test_grade(self): + grade = get_grade("_Test Grading Scale", 80) + self.assertEquals("A", grade) + + grade = get_grade("_Test Grading Scale", 70) + self.assertEquals("B", grade) + \ No newline at end of file diff --git a/erpnext/schools/doctype/evaluation_criteria/test_records.json b/erpnext/schools/doctype/evaluation_criteria/test_records.json new file mode 100644 index 0000000000..64ff701cf4 --- /dev/null +++ b/erpnext/schools/doctype/evaluation_criteria/test_records.json @@ -0,0 +1,8 @@ +[ + { + "evaluation_criteria": "_Test Evaluation Criteria" + }, + { + "evaluation_criteria": "_Test Evaluation Criteria 1" + } +] \ No newline at end of file diff --git a/erpnext/schools/doctype/grading_scale/test_records.json b/erpnext/schools/doctype/grading_scale/test_records.json new file mode 100644 index 0000000000..fbe7d990aa --- /dev/null +++ b/erpnext/schools/doctype/grading_scale/test_records.json @@ -0,0 +1,15 @@ +[ + { + "grading_scale_name": "_Test Grading Scale", + "intervals": [ + { + "grade_code": "A", + "threshold": 75 + }, + { + "grade_code": "B", + "threshold": 50 + } + ] + } +] \ No newline at end of file From 2a9e0f6fd895e822876f1e9a8eb21a0724bd0667 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Mon, 9 Jan 2017 18:25:43 +0530 Subject: [PATCH 7/7] Added assessment result tool --- erpnext/config/desktop.py | 9 - erpnext/config/schools.py | 4 + erpnext/public/build.json | 3 +- erpnext/public/css/erpnext.css | 22 ++ .../js/schools/assessment_result_tool.html | 44 +++ erpnext/public/less/erpnext.less | 25 ++ erpnext/schools/api.py | 61 +++- .../assessment_plan/assessment_plan.js | 1 + .../assessment_plan/assessment_plan.json | 312 ++++++++++-------- .../assessment_plan/assessment_plan.py | 8 + .../assessment_result/assessment_result.py | 24 +- .../assessment_result_tool/__init__.py | 0 .../assessment_result_tool.js | 105 ++++++ .../assessment_result_tool.json | 232 +++++++++++++ .../assessment_result_tool.py | 10 + .../doctype/grading_scale/grading_scale.py | 11 +- .../doctype/grading_scale/test_records.json | 4 + 17 files changed, 724 insertions(+), 151 deletions(-) create mode 100644 erpnext/public/js/schools/assessment_result_tool.html create mode 100644 erpnext/schools/doctype/assessment_result_tool/__init__.py create mode 100644 erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js create mode 100644 erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.json create mode 100644 erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.py diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py index 38a584626c..029ef74740 100644 --- a/erpnext/config/desktop.py +++ b/erpnext/config/desktop.py @@ -228,15 +228,6 @@ def get_data(): "_doctype": "Student Applicant", "type": "list" }, - { - "module_name": "Assessment Plan", - "color": "#8a70be", - "icon": "fa fa-file-text-alt", - "label": _("Assessment Plan"), - "link": "List/Assessment Plan", - "_doctype": "Assessment Plan", - "type": "list" - }, { "module_name": "Fees", "color": "#83C21E", diff --git a/erpnext/config/schools.py b/erpnext/config/schools.py index cac6cfa27e..903f54b411 100644 --- a/erpnext/config/schools.py +++ b/erpnext/config/schools.py @@ -129,6 +129,10 @@ def get_data(): { "type": "doctype", "name": "Evaluation Criteria" + }, + { + "type": "doctype", + "name": "Assessment Result Tool" } ] }, diff --git a/erpnext/public/build.json b/erpnext/public/build.json index 30b09000fd..c4056813b6 100644 --- a/erpnext/public/build.json +++ b/erpnext/public/build.json @@ -28,7 +28,8 @@ "public/js/templates/item_selector.html", "public/js/utils/item_selector.js", "public/js/help_links.js", - "public/js/schools/student_button.html" + "public/js/schools/student_button.html", + "public/js/schools/assessment_result_tool.html" ], "js/item-dashboard.min.js": [ "stock/dashboard/item_dashboard.html", diff --git a/erpnext/public/css/erpnext.css b/erpnext/public/css/erpnext.css index ca3b4b5965..7f85de9315 100644 --- a/erpnext/public/css/erpnext.css +++ b/erpnext/public/css/erpnext.css @@ -212,3 +212,25 @@ body[data-route="pos"] .modal-dialog { margin: 15px; width: 130px; } +.frappe-control[data-fieldname='result_html'] { + overflow: scroll; +} +.assessment-result-tool { + table-layout: fixed; +} +.assessment-result-tool input { + width: 100%; + border: 0; + outline: none; + text-align: right; +} +.assessment-result-tool th { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +.assessment-result-tool .total-score, +.assessment-result-tool .grade, +.assessment-result-tool .score { + text-align: right; +} diff --git a/erpnext/public/js/schools/assessment_result_tool.html b/erpnext/public/js/schools/assessment_result_tool.html new file mode 100644 index 0000000000..6f9e2566c2 --- /dev/null +++ b/erpnext/public/js/schools/assessment_result_tool.html @@ -0,0 +1,44 @@ + + + + + + {% for c in criterias %} + + {% endfor %} + + + + + {% for c in criterias %} + + {% endfor %} + + + + + {% for s in students %} + + + + {% for c in criterias %} + + {% endfor %} + + + {% endfor %} + +
StudentStudent Name{{ c.evaluation_criteria }}Total Marks
{{ c.maximum_score }}{{max_total_score}}
{{ s.student }}{{ s.student_name }} + + + {% if(s.assessment_details) { %} {{s.assessment_details.total_score}} {% } %} +
\ No newline at end of file diff --git a/erpnext/public/less/erpnext.less b/erpnext/public/less/erpnext.less index e2ccdddf0e..790a031736 100644 --- a/erpnext/public/less/erpnext.less +++ b/erpnext/public/less/erpnext.less @@ -257,3 +257,28 @@ body[data-route="pos"] .modal-dialog { margin: 15px; width: 130px; } + +// assessment tool +.frappe-control[data-fieldname='result_html'] { + overflow: scroll; +} +.assessment-result-tool { + table-layout: fixed; + + input { + width: 100%; + border: 0; + outline: none; + text-align: right; + } + + th { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + .total-score, .grade, .score { + text-align: right; + } +} \ No newline at end of file diff --git a/erpnext/schools/api.py b/erpnext/schools/api.py index e48748e621..e31a9444ca 100644 --- a/erpnext/schools/api.py +++ b/erpnext/schools/api.py @@ -7,7 +7,7 @@ import frappe import json from frappe import _ from frappe.model.mapper import get_mapped_doc -from frappe.utils import flt +from frappe.utils import flt, cstr @frappe.whitelist() def enroll_student(source_name): @@ -84,7 +84,7 @@ def make_attendance_records(student, student_name, status, course_schedule=None, @frappe.whitelist() def get_student_batch_students(student_batch): - """Returns List of student, student_name in Student Batch. + """Returns List of student, student_name, idx in Student Batch. :param student_batch: Student Batch. """ @@ -172,7 +172,26 @@ def get_evaluation_criterias(course): """ return frappe.get_list("Course Evaluation Criteria", \ fields=["evaluation_criteria", "weightage"], filters={"parent": course}, order_by= "idx") - + +@frappe.whitelist() +def get_assessment_students(assessment_plan, student_group=None, student_batch=None): + student_list = [] + if student_group: + student_list = get_student_group_students(student_group) + elif student_batch: + student_list = get_student_batch_students(student_batch) + for i, student in enumerate(student_list): + result = get_result(student.student, assessment_plan) + if result: + student_result = {} + for d in result.details: + student_result.update({d.evaluation_criteria: cstr(d.score) + " ("+ d.grade + ")"}) + student_result.update({"total_score": cstr(result.total_score) + " (" + result.grade + ")"}) + student.update({'assessment_details': student_result}) + else: + student.update({'assessment_details': None}) + return student_list + @frappe.whitelist() def get_assessment_details(assessment_plan): """Returns Evaluation Criteria and Maximum Score from Assessment Plan Master. @@ -182,6 +201,18 @@ def get_assessment_details(assessment_plan): return frappe.get_list("Assessment Evaluation Criteria", \ fields=["evaluation_criteria", "maximum_score"], filters={"parent": assessment_plan}, order_by= "idx") +@frappe.whitelist() +def get_result(student, assessment_plan): + """Returns Submitted Result of given student for specified Assessment Plan + + :param Student: Student + :param Assessment Plan: Assessment Plan + """ + results = frappe.get_all("Assessment Result", filters={"student": student, "assessment_plan": assessment_plan, "docstatus": 1}) + if results: + return frappe.get_doc("Assessment Result", results[0]) + else: + return None @frappe.whitelist() def get_grade(grading_scale, percentage): @@ -199,5 +230,25 @@ def get_grade(grading_scale, percentage): grade = grading_scale_intervals.get(interval) break else: - grade = "Unsuccessful" - return grade \ No newline at end of file + grade = "" + return grade + +@frappe.whitelist() +def mark_assessment_result(student, assessment_plan, scores): + student_score = json.loads(scores) + details = [] + for s in student_score.keys(): + details.append({ + "evaluation_criteria": s, + "score": flt(student_score[s]) + }) + assessment_result = frappe.new_doc("Assessment Result") + assessment_result.update({ + "student": student, + "student_name": frappe.db.get_value("Student", student, "title"), + "assessment_plan": assessment_plan, + "details": details + }) + assessment_result.save() + assessment_result.submit() + return assessment_result \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment_plan/assessment_plan.js b/erpnext/schools/doctype/assessment_plan/assessment_plan.js index 7b746ffb77..374b444a96 100644 --- a/erpnext/schools/doctype/assessment_plan/assessment_plan.js +++ b/erpnext/schools/doctype/assessment_plan/assessment_plan.js @@ -2,6 +2,7 @@ // For license information, please see license.txt cur_frm.add_fetch("student_group", "course", "course"); +cur_frm.add_fetch("student_group", "student_batch", "student_batch"); cur_frm.add_fetch("examiner", "instructor_name", "examiner_name"); cur_frm.add_fetch("supervisor", "instructor_name", "supervisor_name"); diff --git a/erpnext/schools/doctype/assessment_plan/assessment_plan.json b/erpnext/schools/doctype/assessment_plan/assessment_plan.json index 10ae53c7bb..967c689f0d 100644 --- a/erpnext/schools/doctype/assessment_plan/assessment_plan.json +++ b/erpnext/schools/doctype/assessment_plan/assessment_plan.json @@ -73,18 +73,18 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "student_group", + "fieldname": "assessment_group", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, - "in_list_view": 1, + "in_list_view": 0, "in_standard_filter": 1, - "label": "Student Group", + "label": "Assessment Group", "length": 0, "no_copy": 0, - "options": "Student Group", + "options": "Assessment Group", "permlevel": 0, "precision": "", "print_hide": 0, @@ -97,92 +97,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "student_batch", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Student Batch", - "length": 0, - "no_copy": 0, - "options": "Student Batch", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "examiner", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Examiner", - "length": 0, - "no_copy": 0, - "options": "Instructor", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "examiner_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Examiner Name", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_on_submit": 0, "bold": 0, @@ -239,35 +153,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "assessment_group", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 1, - "label": "Assessment Group", - "length": 0, - "no_copy": 0, - "options": "Assessment Group", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_on_submit": 0, "bold": 0, @@ -320,7 +205,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -330,18 +215,16 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "supervisor", - "fieldtype": "Link", + "fieldname": "section_break_10", + "fieldtype": "Section Break", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Supervisor", "length": 0, "no_copy": 0, - "options": "Instructor", "permlevel": 0, "precision": "", "print_hide": 0, @@ -359,22 +242,79 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "supervisor_name", - "fieldtype": "Data", + "fieldname": "student_group", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Student Group", + "length": 0, + "no_copy": 0, + "options": "Student Group", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_10", + "fieldtype": "Column Break", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Supervisor Name", "length": 0, "no_copy": 0, "permlevel": 0, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, - "read_only": 1, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "student_batch", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Student Batch", + "length": 0, + "no_copy": 0, + "options": "Student Batch", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, @@ -470,6 +410,63 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "examiner", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Examiner", + "length": 0, + "no_copy": 0, + "options": "Instructor", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "examiner_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Examiner Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -553,6 +550,63 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "supervisor", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Supervisor", + "length": 0, + "no_copy": 0, + "options": "Instructor", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "supervisor_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Supervisor Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_on_submit": 0, "bold": 0, @@ -649,7 +703,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-01-04 16:21:40.752137", + "modified": "2017-01-05 12:15:33.183100", "modified_by": "Administrator", "module": "Schools", "name": "Assessment Plan", diff --git a/erpnext/schools/doctype/assessment_plan/assessment_plan.py b/erpnext/schools/doctype/assessment_plan/assessment_plan.py index 4c472fc87a..aa84ae342d 100644 --- a/erpnext/schools/doctype/assessment_plan/assessment_plan.py +++ b/erpnext/schools/doctype/assessment_plan/assessment_plan.py @@ -9,8 +9,12 @@ from frappe import _ class AssessmentPlan(Document): def validate(self): + if not (self.student_batch or self.student_group): + frappe.throw(_("Please select Student Group or Student Batch")) + self.validate_student_batch() self.validate_overlap() + def validate_overlap(self): """Validates overlap for Student Group/Student Batch, Instructor, Room""" @@ -35,3 +39,7 @@ class AssessmentPlan(Document): validate_overlap_for(self, "Assessment Plan", "room") validate_overlap_for(self, "Assessment Plan", "supervisor", self.supervisor) + + def validate_student_batch(self): + if self.student_group: + self.student_batch = frappe.db.get_value("Student Group", self.student_group, "student_batch") \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment_result/assessment_result.py b/erpnext/schools/doctype/assessment_result/assessment_result.py index d39f3ca67e..860dcbd8ae 100644 --- a/erpnext/schools/doctype/assessment_result/assessment_result.py +++ b/erpnext/schools/doctype/assessment_result/assessment_result.py @@ -4,21 +4,33 @@ from __future__ import unicode_literals import frappe +from frappe import _ from frappe.utils import flt from frappe.model.document import Document from erpnext.schools.api import get_grade +from erpnext.schools.api import get_assessment_details class AssessmentResult(Document): def validate(self): - self.maximum_score = frappe.db.get_value("Assessment Plan", self.assessment_plan, "maximum_assessment_score") + self.grading_scale = frappe.db.get_value("Assessment Plan", self.assessment_plan, "grading_scale") + self.validate_maximum_score() self.validate_grade() + def validate_maximum_score(self): + self.maximum_score = frappe.db.get_value("Assessment Plan", self.assessment_plan, "maximum_assessment_score") + assessment_details = get_assessment_details(self.assessment_plan) + max_scores = {} + for d in assessment_details: + max_scores.update({d.evaluation_criteria: d.maximum_score}) + + for d in self.details: + d.maximum_score = max_scores.get(d.evaluation_criteria) + if d.score > d.maximum_score: + frappe.throw(_("Score cannot be greater than Maximum Score")) + def validate_grade(self): self.total_score = 0.0 for d in self.details: - if d.score > d.maximum_score: - frappe.throw(_("Score cannot be greater than Maximum Score")) - else: - d.grade = get_grade(self.grading_scale, (flt(d.score)/d.maximum_score)*100) - self.total_score += d.score + d.grade = get_grade(self.grading_scale, (flt(d.score)/d.maximum_score)*100) + self.total_score += d.score self.grade = get_grade(self.grading_scale, (self.total_score/self.maximum_score)*100) diff --git a/erpnext/schools/doctype/assessment_result_tool/__init__.py b/erpnext/schools/doctype/assessment_result_tool/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js new file mode 100644 index 0000000000..c58304beca --- /dev/null +++ b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js @@ -0,0 +1,105 @@ +// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +cur_frm.add_fetch("assessment_plan", "student_group", "student_group"); +cur_frm.add_fetch("assessment_plan", "student_batch", "student_batch"); + +frappe.ui.form.on('Assessment Result Tool', { + refresh: function(frm) { + frm.disable_save(); + frm.page.clear_indicator(); + }, + + assessment_plan: function(frm) { + if(!(frm.doc.student_batch || frm.doc.student_group)) return; + frappe.call({ + method: "erpnext.schools.api.get_assessment_students", + args: { + "assessment_plan": frm.doc.assessment_plan, + "student_batch": frm.doc.student_batch, + "student_group": frm.doc.student_group + }, + callback: function(r) { + frm.events.render_table(frm, r.message); + } + }); + }, + + render_table: function(frm, students) { + $(frm.fields_dict.result_html.wrapper).empty(); + var assessment_plan = frm.doc.assessment_plan; + var student_scores = {}; + students.forEach(function(stu) { + student_scores[stu.student] = {} + }); + + frappe.call({ + method: "erpnext.schools.api.get_assessment_details", + args: { + assessment_plan: assessment_plan + }, + callback: function(r) { + var criterias = r.message; + var max_total_score = 0; + criterias.forEach(function(c) { + max_total_score += c.maximum_score + }); + var result_table = $(frappe.render_template('assessment_result_tool', { + frm: frm, + students: students, + criterias: criterias, + max_total_score: max_total_score + })); + result_table.appendTo(frm.fields_dict.result_html.wrapper) + + result_table.on('change', 'input', function(e) { + var $input = $(e.target); + var max_score = $input.data().maxScore; + var student = $input.data().student; + var criteria = $input.data().criteria; + var value = $input.val(); + if(value < 0) { + $input.val(0); + value = 0; + } + if(value > max_score) { + $input.val(max_score); + value = max_score; + } + student_scores[student][criteria] = value; + if(Object.keys(student_scores[student]).length == criterias.length) { + frappe.call(({ + method: "erpnext.schools.api.mark_assessment_result", + args: { + "student": student, + "assessment_plan": assessment_plan, + "scores": student_scores[student] + }, + callback: function(r) { + var doc = r.message; + var student = doc.student; + result_table.find(`[data-student=${student}].total-score`) + .html(doc.total_score + ' ('+ doc.grade + ')'); + var details = doc.details; + result_table.find(`tr[data-student=${student}]`).addClass('text-muted'); + result_table.find(`input[data-student=${student}]`).each(function(el, input) { + var $input = $(input); + var criteria = $input.data().criteria; + var value = $input.val(); + var grade = details.find(function(d) { + return d.evaluation_criteria === criteria; + }).grade; + $input.val(`${value} (${grade})`); + $input.attr('disabled', true); + }); + + } + })) + } + }); + + } + }); + }, + +}); diff --git a/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.json b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.json new file mode 100644 index 0000000000..87dff4d154 --- /dev/null +++ b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.json @@ -0,0 +1,232 @@ +{ + "allow_copy": 1, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-01-05 12:27:48.951036", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "", + "fieldname": "assessment_plan", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Assessment Plan", + "length": 0, + "no_copy": 0, + "options": "Assessment Plan", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_2", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "student_group", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Student Group", + "length": 0, + "no_copy": 0, + "options": "Student Group", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "student_batch", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Student Batch", + "length": 0, + "no_copy": 0, + "options": "Student Batch", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "depends_on": "assessment_plan", + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "result_html", + "fieldtype": "HTML", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Result HTML", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 1, + "hide_toolbar": 1, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 1, + "istable": 0, + "max_attachments": 0, + "modified": "2017-01-05 15:45:59.338722", + "modified_by": "Administrator", + "module": "Schools", + "name": "Assessment Result Tool", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 0, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 0, + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.py b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.py new file mode 100644 index 0000000000..a0d286ccbe --- /dev/null +++ b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class AssessmentResultTool(Document): + pass diff --git a/erpnext/schools/doctype/grading_scale/grading_scale.py b/erpnext/schools/doctype/grading_scale/grading_scale.py index 8e66f1a2d4..f7f6ba9d92 100644 --- a/erpnext/schools/doctype/grading_scale/grading_scale.py +++ b/erpnext/schools/doctype/grading_scale/grading_scale.py @@ -4,7 +4,16 @@ from __future__ import unicode_literals import frappe +from frappe import _ from frappe.model.document import Document class GradingScale(Document): - pass + def validate(self): + thresholds = [] + for d in self.intervals: + if d.threshold in thresholds: + frappe.throw(_("Treshold {0}% appears more than once.".format(d.threshold))) + else: + thresholds.append(d.threshold) + if 0 not in thresholds: + frappe.throw(_("Please define grade for treshold 0%")) \ No newline at end of file diff --git a/erpnext/schools/doctype/grading_scale/test_records.json b/erpnext/schools/doctype/grading_scale/test_records.json index fbe7d990aa..72b69547ac 100644 --- a/erpnext/schools/doctype/grading_scale/test_records.json +++ b/erpnext/schools/doctype/grading_scale/test_records.json @@ -9,6 +9,10 @@ { "grade_code": "B", "threshold": 50 + }, + { + "grade_code": "C", + "threshold": 0 } ] }