diff --git a/app/Models/HitAndRun.php b/app/Models/HitAndRun.php index 6dd8d70d..e0b76d41 100644 --- a/app/Models/HitAndRun.php +++ b/app/Models/HitAndRun.php @@ -62,6 +62,10 @@ class HitAndRun extends NexusModel if ($this->status != self::STATUS_INSPECTING) { return '---'; } + if (!$this->snatch->completedat) { + //not download completed + return '---'; + } $searchBoxId = $this->torrent->basic_category->mode ?? 0; if ($searchBoxId == 0) { do_log(sprintf('[INVALID_CATEGORY], Torrent: %s', $this->torrent_id), 'error'); diff --git a/app/Repositories/HitAndRunRepository.php b/app/Repositories/HitAndRunRepository.php index 66c5633b..0a547200 100644 --- a/app/Repositories/HitAndRunRepository.php +++ b/app/Repositories/HitAndRunRepository.php @@ -236,7 +236,7 @@ class HitAndRunRepository extends BaseRepository 'added' => Carbon::now()->toDateTimeString(), 'subject' => nexus_trans('hr.reached_message_subject', ['hit_and_run_id' => $hitAndRun->id], $hitAndRun->user->locale), 'msg' => nexus_trans('hr.reached_message_content', [ - 'completed_at' => $hitAndRun->snatch->completedat->toDateTimeString(), + 'completed_at' => format_datetime($hitAndRun->snatch->completedat), 'torrent_id' => $hitAndRun->torrent_id, 'torrent_name' => $hitAndRun->torrent->name, ], $hitAndRun->user->locale), @@ -335,7 +335,7 @@ class HitAndRunRepository extends BaseRepository 'added' => Carbon::now()->toDateTimeString(), 'subject' => nexus_trans('hr.unreached_message_subject', ['hit_and_run_id' => $hitAndRun->id], $hitAndRun->user->locale), 'msg' => nexus_trans('hr.unreached_message_content', [ - 'completed_at' => $hitAndRun->snatch->completedat->toDateTimeString(), + 'completed_at' => format_datetime($hitAndRun->snatch->completedat), 'torrent_id' => $hitAndRun->torrent_id, 'torrent_name' => $hitAndRun->torrent->name, ], $hitAndRun->user->locale), diff --git a/include/constants.php b/include/constants.php index 7e9f6a88..f437147a 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ = $requiredDownloaded) { $sql = "insert into hit_and_runs (uid, torrent_id, snatched_id) values ($userid, $torrentid, {$snatchInfo['id']}) on duplicate key update updated_at = " . sqlesc(date('Y-m-d H:i:s')); $affectedRows = sql_query($sql); - do_log("$hrLog, total downloaded: {$snatchInfo['downloaded']} > required: $requiredDownloaded, [INSERT_H&R], sql: $sql, affectedRows: $affectedRows"); + do_log("$hrLog, total downloaded: {$snatchInfo['downloaded']} >= required: $requiredDownloaded, [INSERT_H&R], sql: $sql, affectedRows: $affectedRows"); } else { - do_log("$hrLog, total downloaded: {$snatchInfo['downloaded']} <= required: $requiredDownloaded", "debug"); + do_log("$hrLog, total downloaded: {$snatchInfo['downloaded']} < required: $requiredDownloaded", "debug"); } } else { do_log("$hrLog, already exists", "debug");