Skip to content

Commit

Permalink
Fixed demo script
Browse files Browse the repository at this point in the history
  • Loading branch information
deepshig committed Jul 13, 2016
1 parent 75c3889 commit d32bb9c
Show file tree
Hide file tree
Showing 9 changed files with 2,293 additions and 2,582 deletions.
12 changes: 6 additions & 6 deletions schools/academics/doctype/student/student.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
from frappe.model.document import Document

class Student(Document):

def validate(self):
self.title = " ".join(filter(None, [self.first_name, self.middle_name, self.last_name]))

if self.student_applicant:
self.check_unique()
self.update_applicant_status()

def check_unique(self):
"""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))

def update_applicant_status(self):
"""Updates Student Applicant status to Admitted"""
if self.student_applicant:
Expand All @@ -29,9 +29,9 @@ def update_applicant_status(self):
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
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)
and status = 'Present'
group by cs.schedule_date''', name))
group by cs.schedule_date''', name))
Loading

0 comments on commit d32bb9c

Please sign in to comment.