Skip to content

Commit

Permalink
Merge pull request pkp#1498 from bozana/9582
Browse files Browse the repository at this point in the history
pkp/pkp-lib#9582 fix get date from string and submodule update
  • Loading branch information
bozana authored Jan 6, 2024
2 parents 48b6ce9 + 25fd79b commit 6097fa1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions classes/statistics/TemporaryTotalsDAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
namespace APP\statistics;

use APP\core\Application;
use DateTimeImmutable;
use Illuminate\Support\Facades\DB;
use PKP\config\Config;
use PKP\db\DAORegistry;
Expand Down Expand Up @@ -52,8 +53,8 @@ protected function getInsertData(object $entryData): array
*/
public function compileSeriesMetrics(string $loadId): void
{
$date = substr($loadId, -12, 8);
DB::table('metrics_series')->where('load_id', '=', $loadId)->orWhere('date', '=', DB::raw("DATE({$date})"))->delete();
$date = DateTimeImmutable::createFromFormat('Ymd', substr($loadId, -12, 8));
DB::table('metrics_series')->where('load_id', '=', $loadId)->orWhereDate('date', '=', $date)->delete();
$selectSeriesMetrics = DB::table($this->table)
->select(DB::raw('load_id, context_id, series_id, DATE(date) as date, count(*) as metric'))
->where('load_id', '=', $loadId)
Expand All @@ -67,8 +68,8 @@ public function compileSeriesMetrics(string $loadId): void
*/
public function compileSubmissionMetrics(string $loadId): void
{
$date = substr($loadId, -12, 8);
DB::table('metrics_submission')->where('load_id', '=', $loadId)->orWhere('date', '=', DB::raw("DATE({$date})"))->delete();
$date = DateTimeImmutable::createFromFormat('Ymd', substr($loadId, -12, 8));
DB::table('metrics_submission')->where('load_id', '=', $loadId)->orWhereDate('date', '=', $date)->delete();
$selectSubmissionMetrics = DB::table($this->table)
->select(DB::raw('load_id, context_id, submission_id, assoc_type, DATE(date) as date, count(*) as metric'))
->where('load_id', '=', $loadId)
Expand Down
2 changes: 1 addition & 1 deletion lib/pkp

0 comments on commit 6097fa1

Please sign in to comment.