summaryrefslogtreecommitdiff
path: root/includes/model/UserWorkLog_model.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/model/UserWorkLog_model.php')
-rw-r--r--includes/model/UserWorkLog_model.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/includes/model/UserWorkLog_model.php b/includes/model/UserWorkLog_model.php
index cc7686cf..e785067d 100644
--- a/includes/model/UserWorkLog_model.php
+++ b/includes/model/UserWorkLog_model.php
@@ -22,14 +22,24 @@ function UserWorkLog($user_worklog_id)
/**
* Returns all work log entries for a user.
*
- * @param int $userId
+ * @param int $userId
+ * @param Carbon|null $sinceTime
* @return array[]
*/
-function UserWorkLogsForUser($userId)
+function UserWorkLogsForUser($userId, Carbon $sinceTime = null)
{
- return Db::select("SELECT * FROM `UserWorkLog` WHERE `user_id`=? ORDER BY `created_timestamp`", [
- $userId
- ]);
+ return Db::select(
+ '
+ SELECT *
+ FROM `UserWorkLog`
+ WHERE `user_id`=?
+ ' . ($sinceTime ? 'AND work_timestamp >= ' . $sinceTime->getTimestamp() : '') . '
+ ORDER BY `created_timestamp`
+ ',
+ [
+ $userId
+ ]
+ );
}
/**