Exemplo n.º 1
0
    def get(self):
        email = self.request.get('email')
        runLogs = RunLogs.query_by_id(email)

        runDict = {}
        keyList = []
        testList = []
        if runLogs != None:
            tempList = list(runLogs.RunHistory)
            tempList.reverse()
            if len(tempList) > 5:
                tempList2 = list(tempList[:5])
            else:
                tempList2 = list(tempList)
                
            for run in tempList2:
                print run
                runHist = Run.query_by_id(run) #run is key_id(), runHist is Run object
                date = str(runHist.date)
                testList.append(str(runHist.date))
                temp = date.split("-",1)[1]
                date_s = temp.split(" ",1)[0]
                runDict[date] = runHist.time
                date = re.sub("-","/" ,date_s)
                keyList.append(date)

        self.response.write(json.dumps({"dateList": keyList, "timeDict": runDict, "testList": testList}))
Exemplo n.º 2
0
    def get(self):
        email = self.request.get('email')
        runLogs = RunLogs.query_by_id(email)

        runDict = {}
        keyList = []
        testList = []
        if runLogs != None:
            tempList = list(runLogs.RunHistory)
            tempList.reverse()
            if len(tempList) > 5:
                tempList2 = list(tempList[:5])
            else:
                tempList2 = list(tempList)

            for run in tempList2:
                print run
                runHist = Run.query_by_id(
                    run)  #run is key_id(), runHist is Run object
                date = str(runHist.date)
                testList.append(str(runHist.date))
                temp = date.split("-", 1)[1]
                date_s = temp.split(" ", 1)[0]
                runDict[date] = runHist.time
                date = re.sub("-", "/", date_s)
                keyList.append(date)

        self.response.write(
            json.dumps({
                "dateList": keyList,
                "timeDict": runDict,
                "testList": testList
            }))