From 50862039dcb6fc2279f985f54d1448b1096883c0 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 6 Feb 2017 14:28:40 +0530 Subject: [PATCH] [minor] fixes to schools --- .../assessment_criteria/assessment_criteria.json | 6 ++---- .../doctype/grading_scale/grading_scale.py | 5 +++-- erpnext/schools/doctype/student/student.py | 15 +++++++-------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/erpnext/schools/doctype/assessment_criteria/assessment_criteria.json b/erpnext/schools/doctype/assessment_criteria/assessment_criteria.json index dd6d5dd656..990b22bebd 100644 --- a/erpnext/schools/doctype/assessment_criteria/assessment_criteria.json +++ b/erpnext/schools/doctype/assessment_criteria/assessment_criteria.json @@ -22,7 +22,6 @@ "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, - "in_filter": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Assessment Criteria", @@ -42,7 +41,7 @@ }, { "allow_on_submit": 0, - "bold": 0, + "bold": 1, "collapsible": 0, "columns": 0, "fieldname": "assessment_criteria_group", @@ -50,7 +49,6 @@ "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, - "in_filter": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Assessment Criteria Group", @@ -80,7 +78,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-02-01 17:41:48.994388", + "modified": "2017-02-03 05:53:39.248759", "modified_by": "Administrator", "module": "Schools", "name": "Assessment Criteria", diff --git a/erpnext/schools/doctype/grading_scale/grading_scale.py b/erpnext/schools/doctype/grading_scale/grading_scale.py index f7f6ba9d92..4abff96462 100644 --- a/erpnext/schools/doctype/grading_scale/grading_scale.py +++ b/erpnext/schools/doctype/grading_scale/grading_scale.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import frappe from frappe import _ +from frappe.utils import cint from frappe.model.document import Document class GradingScale(Document): @@ -12,8 +13,8 @@ class GradingScale(Document): thresholds = [] for d in self.intervals: if d.threshold in thresholds: - frappe.throw(_("Treshold {0}% appears more than once.".format(d.threshold))) + frappe.throw(_("Treshold {0}% appears more than once".format(d.threshold))) else: - thresholds.append(d.threshold) + thresholds.append(cint(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/student/student.py b/erpnext/schools/doctype/student/student.py index a34bb6a599..b660bb3363 100644 --- a/erpnext/schools/doctype/student/student.py +++ b/erpnext/schools/doctype/student/student.py @@ -5,9 +5,9 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document +from frappe import _ class Student(Document): - def validate(self): self.title = " ".join(filter(None, [self.first_name, self.middle_name, self.last_name])) @@ -19,7 +19,7 @@ class Student(Document): """Validates if the Student Applicant is Unique""" student = frappe.db.sql("select name from `tabStudent` where student_applicant=%s and name!=%s", (self.student_applicant, self.name)) if student: - frappe.throw("Student {0} exist against student applicant {1}".format(student[0][0], self.student_applicant)) + frappe.throw(_("Student {0} exist against student applicant {1}").format(student[0][0], self.student_applicant)) def update_applicant_status(self): """Updates Student Applicant status to Admitted""" @@ -28,10 +28,9 @@ class Student(Document): def get_timeline_data(doctype, name): '''Return timeline for attendance''' - return dict(frappe.db.sql('''select unix_timestamp(cs.schedule_date), count(*) - from `tabCourse Schedule` as cs , `tabStudent Attendance` as sa where - sa.course_schedule = cs.name - and sa.student=%s - and cs.schedule_date > date_sub(curdate(), interval 1 year) + return dict(frappe.db.sql('''select unix_timestamp(`date`), count(*) + from `tabStudent Attendance` where + student=%s + and `date` > date_sub(curdate(), interval 1 year) and status = 'Present' - group by cs.schedule_date''', name)) + group by date''', name))