def getTodaysDebt(self):
		import datetime
		from tuition.tools.models import Debt
		from tuition.utils.manager import AppManager

		serializedObjects = []
		loggedInEmployee = AppManager.getUserByEmail(AppManager.getCurrentLoggedInUser().email())
		today = datetime.date.today()
		todaysDebt = Debt.all().filter('user ='******'incurredDate =', today).order('-incurredDate')
		todaysDebt = todaysDebt.fetch(limit=1000)
		for debt in todaysDebt:
			serializedObjects.append(debt.toDict)
		return self.respond(debts=serializedObjects)
	def getDebtThisWeek(self):
		import datetime
		from tuition.tools.models import Debt
		from tuition.utils.manager import AppManager
		from tuition.utils.utils import weekStartEnd

		serializedObjects = []
		loggedInEmployee = AppManager.getUserByEmail(AppManager.getCurrentLoggedInUser().email())
		startOfWeek = weekStartEnd().get('start')
		thisWeeksDebt = Debt.all().filter('user ='******'incurredDate >=', startOfWeek).order('-incurredDate')
		thisWeeksDebt = thisWeeksDebt.fetch(limit=1000)
		for debt in thisWeeksDebt:
			serializedObjects.append(debt.toDict)
		return self.respond(debts=serializedObjects)
Exemple #3
0
    def getTodaysDebt(self):
        import datetime
        from tuition.tools.models import Debt
        from tuition.utils.manager import AppManager

        serializedObjects = []
        loggedInEmployee = AppManager.getUserByEmail(
            AppManager.getCurrentLoggedInUser().email())
        today = datetime.date.today()
        todaysDebt = Debt.all().filter('user ='******'incurredDate =',
                                           today).order('-incurredDate')
        todaysDebt = todaysDebt.fetch(limit=1000)
        for debt in todaysDebt:
            serializedObjects.append(debt.toDict)
        return self.respond(debts=serializedObjects)
	def getDebtThisMonth(self, values):
		import datetime
		from tuition.tools.models import Debt
		from tuition.utils.manager import AppManager
		from tuition.utils.utils import getMonthEnd

		serializedObjects = []
		year = int(values.get('year', 2013))
		month = int(values.get('month', datetime.date.today().month))
		loggedInEmployee = AppManager.getUserByEmail(AppManager.getCurrentLoggedInUser().email())
		firstOfMonth = datetime.date(year, month, 1)
		endOfMonth = datetime.date(year, month, getMonthEnd(month, year))
		thisMonthDebts = Debt.all().filter('user ='******'incurredDate >=', firstOfMonth).filter('incurredDate <=', endOfMonth).order('-incurredDate')
		thisMonthDebts = thisMonthDebts.fetch(limit=1000)
		for debt in thisMonthDebts:
			serializedObjects.append(debt.toDict)
		return self.respond(debts=serializedObjects)
Exemple #5
0
    def getDebtThisWeek(self):
        import datetime
        from tuition.tools.models import Debt
        from tuition.utils.manager import AppManager
        from tuition.utils.utils import weekStartEnd

        serializedObjects = []
        loggedInEmployee = AppManager.getUserByEmail(
            AppManager.getCurrentLoggedInUser().email())
        startOfWeek = weekStartEnd().get('start')
        thisWeeksDebt = Debt.all().filter(
            'user ='******'incurredDate >=',
                                           startOfWeek).order('-incurredDate')
        thisWeeksDebt = thisWeeksDebt.fetch(limit=1000)
        for debt in thisWeeksDebt:
            serializedObjects.append(debt.toDict)
        return self.respond(debts=serializedObjects)
Exemple #6
0
    def getDebtThisMonth(self, values):
        import datetime
        from tuition.tools.models import Debt
        from tuition.utils.manager import AppManager
        from tuition.utils.utils import getMonthEnd

        serializedObjects = []
        year = int(values.get('year', 2013))
        month = int(values.get('month', datetime.date.today().month))
        loggedInEmployee = AppManager.getUserByEmail(
            AppManager.getCurrentLoggedInUser().email())
        firstOfMonth = datetime.date(year, month, 1)
        endOfMonth = datetime.date(year, month, getMonthEnd(month, year))
        thisMonthDebts = Debt.all().filter(
            'user ='******'incurredDate >=',
                firstOfMonth).filter('incurredDate <=',
                                     endOfMonth).order('-incurredDate')
        thisMonthDebts = thisMonthDebts.fetch(limit=1000)
        for debt in thisMonthDebts:
            serializedObjects.append(debt.toDict)
        return self.respond(debts=serializedObjects)