
from google.appengine.ext import ndb
from employee import Employee

class Constrain(ndb.Model):
	employee = ndb.KeyProperty(kind = Employee)
	constrianDay = ndb.IntegerProperty()
	constrianWeek = ndb.IntegerProperty()
	ShiftType = ndb.IntegerProperty()
	constrainKind = ndb.IntegerProperty()
	notes = ndb.StringProperty()

		
	def getShiftHeads(self, day, month, shift, satisfactory):
		if not day or not month or not shift or not satisfactory:
			return False
	
		employees = []
		list = Constrain.query(Constrain.constrainDay == day and Constrain.constrainMonth == month
								and Constrain.shiftType == shift, Constrain.constrainKind == satisfactory and Constrain.employee.shiftHead)
		
		if list:
			for l in list:
				employees.append(l.employee.userName)
				
			return employees
		else:
			return None	
@@ -790,16 +790,29 @@
 %09%09else:%0A
+%3C%3C%3C%3C%3C%3C%3C HEAD%0A
 %09%09%09retur
@@ -818,8 +818,60 @@
 rn None%09
+%0A=======%0A%09%09%09return None%0A%09%0A%09%0A%09%0A%3E%3E%3E%3E%3E%3E%3E origin/master%0A

add constrains the same