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 )
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']]])
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']]])
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)
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"]]], )
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"]]], )