Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/Db
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2019-12-25 09:20:13 +0300
committerdartcafe <github@dartcafe.de>2019-12-25 09:20:13 +0300
commit16e436781df32d421f17a9872bd35d62dfffe02e (patch)
tree91c2f870d59ac6fe9814441d507b623655c2d7de /lib/Db
parent9fc13c0c748b319efacbedeb79fae74436d05e8e (diff)
finished LogService
Diffstat (limited to 'lib/Db')
-rw-r--r--lib/Db/LogMapper.php30
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/Db/LogMapper.php b/lib/Db/LogMapper.php
index 51f528c4..cd89ea36 100644
--- a/lib/Db/LogMapper.php
+++ b/lib/Db/LogMapper.php
@@ -38,22 +38,32 @@ class LogMapper extends QBMapper {
parent::__construct($db, 'polls_log', '\OCA\Polls\Db\Log');
}
-
- public function isSameLogWrittenRecently($pollId, $messageId) {
+ public function findByPollId($pollId) {
$qb = $this->db->getQueryBuilder();
$qb->select('*')
->from($this->getTableName())
->where(
- $qb->expr()->eq('poll_id', $qb->createNamedParameter($pollId, IQueryBuilder::PARAM_INT))
- )
- ->andWhere(
- $qb->expr()->eq('message_id', $qb->createNamedParameter($messageId, IQueryBuilder::PARAM_STR))
- )
- ->andWhere('created >:compare');
- $qb->setParameter('compare', time()-300);
- return (count($this->findEntities($qb)) > 0);
+ $qb->expr()->eq('poll_id', $qb->createNamedParameter($pollId, IQueryBuilder::PARAM_INT))
+ );
+
+ return $this->findEntities($qb);
+
+ }
+
+ public function getLastRecord($pollId) {
+ $qb = $this->db->getQueryBuilder();
+
+ $qb->select('*')
+ ->from($this->getTableName())
+ ->where($qb->expr()->eq('poll_id', $qb->createNamedParameter($pollId, IQueryBuilder::PARAM_INT)))
+ ->setMaxResults( 1 )
+ ->orderBy('id', 'DESC');
+
+ return $this->findEntity($qb);
}
+
+
}