[minor] fixes to schools

This commit is contained in:
Rushabh Mehta 2017-02-06 14:28:40 +05:30
parent 259489572d
commit 50862039dc
3 changed files with 12 additions and 14 deletions

View File

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

View File

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

View File

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