Fixed visibility filter endpoint

This commit is contained in:
Maximilian Giller 2021-04-13 19:21:19 +02:00
parent 2525b3c805
commit 8c884779bf

View file

@ -167,7 +167,10 @@ function getRecords($user_id, $limit = NULL, $finished = NULL, $visible = NULL)
if ($visible != NULL) {
$db->innerJoin("projects", "project_id");
}
$db->where("user_id", Comparison::EQUAL, $user_id);
$db->where("ju_time_records.user_id", Comparison::EQUAL, $user_id);
if ($visible != NULL) {
$db->where("ju_projects.visible", Comparison::EQUAL, $visible);
}
if ($finished != NULL) {
if ($finished) {
$db->addSql(" AND end_time IS NOT NULL");
@ -175,9 +178,6 @@ function getRecords($user_id, $limit = NULL, $finished = NULL, $visible = NULL)
$db->addSql(" AND end_time IS NULL");
}
}
if ($visible != NULL) {
$db->where("visible", Comparison::EQUAL, $visible);
}
if ($limit != NULL) {
$db->orderBy("record_id", Order::DESC);
$db->limit($limit);