Skip to content

Commit ed48811

Browse files
Merge pull request #3317 from Leantime/fix/postgresql-round-3301
fix: PostgreSQL ROUND(double precision, int) error on ticket queries (#3301)
2 parents 1c89831 + c75a48e commit ed48811

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/Domain/Tickets/Repositories/Tickets.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public function getAllBySearchCriteria(array $searchCriteria, string $sort = 'st
368368
])
369369
->selectRaw("CASE WHEN zp_tickets.type <> '' THEN zp_tickets.type ELSE 'task' END AS type")
370370
->selectRaw('CASE WHEN ('.$this->dbHelper->wrapColumn('milestone.tags').' IS NULL OR '.$this->dbHelper->wrapColumn('milestone.tags')." = '') THEN 'var(--grey)' ELSE ".$this->dbHelper->wrapColumn('milestone.tags').' END AS '.$this->dbHelper->wrapColumn('milestoneColor'))
371-
->selectRaw('COALESCE(ROUND(timesheet_agg.total_hours, 2), 0) AS '.$this->dbHelper->wrapColumn('bookedHours'));
371+
->selectRaw('COALESCE(timesheet_agg.total_hours, 0) AS '.$this->dbHelper->wrapColumn('bookedHours'));
372372

373373
if ($includeCounts) {
374374
$query->selectRaw('COALESCE(comment_agg.comment_count, 0) AS '.$this->dbHelper->wrapColumn('commentCount'))
@@ -399,7 +399,7 @@ public function getAllBySearchCriteria(array $searchCriteria, string $sort = 'st
399399
->leftJoinSub(
400400
$this->connection->table('zp_timesheets')
401401
->select('ticketId')
402-
->selectRaw('SUM(hours) as total_hours')
402+
->selectRaw('CAST(SUM(hours) AS DECIMAL(10,2)) as total_hours')
403403
->groupBy('ticketId'),
404404
'timesheet_agg',
405405
'zp_tickets.id',

0 commit comments

Comments
 (0)