Skip to content

Commit

Permalink
Merge pull request #972 from nextcloud/fix-device-export-filtered
Browse files Browse the repository at this point in the history
Fix devices exported when filtered #971
  • Loading branch information
tacruc authored Feb 13, 2023
2 parents fa5b3ee + a53b1d9 commit 24a2729
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/Service/DevicesService.php
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ public function getDevicePointsFromDB($userId, $deviceId, $pruneBefore=0) {
);
if (intval($pruneBefore) > 0) {
$qb->andWhere(
$qb->expr()->gt('timestamp', $qb->createNamedParameter($pruneBefore, IQueryBuilder::PARAM_INT))
$qb->expr()->gt('timestamp', $qb->createNamedParameter(intval($pruneBefore), IQueryBuilder::PARAM_INT))
);
}
$qb->orderBy('timestamp', 'ASC');
@@ -153,7 +153,7 @@ public function addPointToDB($deviceId, $lat, $lng, $ts, $altitude, $battery, $a
'device_id' => $qb->createNamedParameter($deviceId, IQueryBuilder::PARAM_STR),
'lat' => $qb->createNamedParameter($lat, IQueryBuilder::PARAM_STR),
'lng' => $qb->createNamedParameter($lng, IQueryBuilder::PARAM_STR),
'timestamp' => $qb->createNamedParameter($ts, IQueryBuilder::PARAM_INT),
'timestamp' => $qb->createNamedParameter(intval($ts), IQueryBuilder::PARAM_INT),
'altitude' => $qb->createNamedParameter(is_numeric($altitude) ? $altitude : null, IQueryBuilder::PARAM_STR),
'battery' => $qb->createNamedParameter(is_numeric($battery) ? $battery : null, IQueryBuilder::PARAM_STR),
'accuracy' => $qb->createNamedParameter(is_numeric($accuracy) ? $accuracy : null, IQueryBuilder::PARAM_STR)
@@ -269,12 +269,12 @@ public function countPoints($userId, $deviceIdList, $begin, $end) {
}
if ($begin !== null && is_numeric($begin)) {
$qb->andWhere(
$qb->expr()->gt('p.timestamp', $qb->createNamedParameter($begin, IQueryBuilder::PARAM_INT))
$qb->expr()->gt('p.timestamp', $qb->createNamedParameter(intval($begin), IQueryBuilder::PARAM_INT))
);
}
if ($end !== null && is_numeric($end)) {
$qb->andWhere(
$qb->expr()->lt('p.timestamp', $qb->createNamedParameter($end, IQueryBuilder::PARAM_INT))
$qb->expr()->lt('p.timestamp', $qb->createNamedParameter(intval($end), IQueryBuilder::PARAM_INT))
);
}
$req = $qb->execute();
@@ -351,12 +351,12 @@ private function getAndWriteDevicePoints($devid, $begin, $end, $fd, $nbPoints, $
);
if (intval($begin) > 0) {
$qb->andWhere(
$qb->expr()->gt('timestamp', $qb->createNamedParameter($begin, IQueryBuilder::PARAM_INT))
$qb->expr()->gt('timestamp', $qb->createNamedParameter(intval($begin), IQueryBuilder::PARAM_INT))
);
}
if (intval($end) > 0) {
$qb->andWhere(
$qb->expr()->lt('timestamp', $qb->createNamedParameter($end, IQueryBuilder::PARAM_INT))
$qb->expr()->lt('timestamp', $qb->createNamedParameter(intval($end), IQueryBuilder::PARAM_INT))
);
}
$qb->setFirstResult($pointIndex);

0 comments on commit 24a2729

Please sign in to comment.