Esempio n. 1
0
    def sql(self, db, data, startLin, endLin, param):

        param = ut.returnParam(param, "activity")

        result = db.query(
            "SELECT starttime,endtime,activity,"
            + "sum(calories),sum(steps) "
            + "FROM sports s INNER JOIN basis b "
            "ON b.insttime>=s.starttime AND b.insttime<=s.endtime "
            'WHERE (activity="'
            + param
            + '") AND starttime>'
            + startLin
            + " AND endtime<"
            + endLin
            + " GROUP BY starttime"
        )

        ut.initialiseData(data, ["steps", "calories"])

        for row in result:
            vals = [["steps", row["sum(steps)"]], ["calories", row["sum(calories)"]]]

            ut.fillData(
                data, math.floor((row["starttime"]) / 86400) * 86400 + 43200, vals
            )
Esempio n. 2
0
    def sql(self, db, data, startLin, endLin, param):

        param = ut.returnParam(param, 'activity')

        result = db.query('SELECT starttime,endtime,activity FROM sports' +
                          ' WHERE (activity="' + param + '") AND starttime>' +
                          startLin + ' AND endtime<' + endLin)

        ut.initialiseData(data, ['duration'])

        for row in result:
            ut.fillData(data,
                        math.floor((row['starttime']) / 86400) * 86400 + 43200,
                        [['duration', row['endtime'] - row['starttime']]])
Esempio n. 3
0
    def sql(self, db, data, startLin, endLin, param):

        param = ut.returnParam(param, 'location')

        result = db.query('SELECT starttime,endtime,intensity ' +
                          'FROM pain WHERE (location="' + param + '") AND ' +
                          ' starttime>=' + startLin + ' AND endtime<=' +
                          endLin)

        ut.initialiseData(data, ['intensity'])

        for row in result:
            ut.fillData(data, (row['starttime'] + row['endtime']) / 2,
                        [['intensity', row['intensity']]])
Esempio n. 4
0
    def sql(self, db, data, startLin, endLin, param):

        param = ut.returnParam(param, 'activity')

        result = db.query(
            'SELECT starttime,endtime,activity,' +
            'sum(calories),sum(steps) ' + 'FROM sports s INNER JOIN basis b '
            'ON b.insttime>=s.starttime AND b.insttime<=s.endtime '
            'WHERE (activity="' + param + '") AND starttime>' + startLin +
            ' AND endtime<' + endLin + ' GROUP BY starttime')

        ut.initialiseData(data, ['steps', 'calories'])

        for row in result:
            vals = [['steps', row['sum(steps)']],
                    ['calories', row['sum(calories)']]]

            ut.fillData(data,
                        math.floor((row['starttime']) / 86400) * 86400 + 43200,
                        vals)
Esempio n. 5
0
    def sql(self, db, data, startLin, endLin, param):

        param = ut.returnParam(param, "activity")

        result = db.query(
            "SELECT starttime,endtime,activity FROM sports"
            + ' WHERE (activity="'
            + param
            + '") AND starttime>'
            + startLin
            + " AND endtime<"
            + endLin
        )

        ut.initialiseData(data, ["duration"])

        for row in result:
            ut.fillData(
                data,
                math.floor((row["starttime"]) / 86400) * 86400 + 43200,
                [["duration", row["endtime"] - row["starttime"]]],
            )
Esempio n. 6
0
    def sql(self, db, data, startLin, endLin, param):

        param = ut.returnParam(param, "location")

        result = db.query(
            "SELECT starttime,endtime,intensity "
            + 'FROM pain WHERE (location="'
            + param
            + '") AND '
            + " starttime>="
            + startLin
            + " AND endtime<="
            + endLin
        )

        ut.initialiseData(data, ["intensity"])

        for row in result:
            ut.fillData(
                data,
                (row["starttime"] + row["endtime"]) / 2,
                [["intensity", row["intensity"]]],
            )