Rename Assessment to Assessment Plan

This commit is contained in:
Neil Trini Lasrado 2017-01-04 17:00:43 +05:30
parent 233ecfdd9c
commit a56224c03a
17 changed files with 77 additions and 93 deletions

View File

@ -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"
},
{

View File

@ -112,7 +112,7 @@ def get_data():
"items": [
{
"type": "doctype",
"name": "Assessment"
"name": "Assessment Plan"
},
{
"type": "doctype",

View File

@ -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"}
]

View File

@ -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

View File

@ -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()

View File

@ -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"
}

View File

@ -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({

View File

@ -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
}

View File

@ -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)

View File

@ -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

View File

@ -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) {

View File

@ -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
}

View File

@ -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):

View File

@ -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");
});
}
});

View File

@ -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)

View File

@ -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");
});
}
},