Skip to content

Commit

Permalink
pkp#9132 fix SQL datetime and date comparison for editorial stats
Browse files Browse the repository at this point in the history
  • Loading branch information
bozana committed Jul 18, 2023
1 parent ffbfadd commit 07907d1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ protected function _getObject(): Builder
// submissions from being counted in editorial stats.
$q->where(
fn (Builder $q) => $q->whereNull('pi.date_published')
->orWhere('s.date_submitted', '<=', DB::raw('pi.date_published'))
->orWhere(DB::raw('CAST(s.date_submitted AS DATE)'), '<=', DB::raw('pi.date_published'))
);

Hook::call('Stats::editorial::queryObject', [&$q, $this]);
Expand Down Expand Up @@ -455,7 +455,7 @@ protected function _getDaysToDecisionsObject($decisions)
public function countImported()
{
return $this->_getBaseQuery()
->whereColumn('s.date_submitted', '>', 'pi.date_published')
->where(DB::raw('CAST(s.date_submitted AS DATE)'), '>', 'pi.date_published')
->when($this->dateStart, fn (Builder $q) => $q->where('s.date_submitted', '>=', $this->dateStart))
->when($this->dateEnd, fn (Builder $q) => $q->where('s.date_submitted', '<=', $this->dateEnd))
->count();
Expand Down

0 comments on commit 07907d1

Please sign in to comment.