Skip to content

Commit

Permalink
fix hr display error when not download completed
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomlove committed Sep 20, 2023
1 parent 36aa10f commit ab517bf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions app/Models/HitAndRun.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ private function doGetInspectTimeLeft(): string
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');
Expand Down
4 changes: 2 additions & 2 deletions app/Repositories/HitAndRunRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private function geReachedMessage(HitAndRun $hitAndRun): array
'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),
Expand Down Expand Up @@ -335,7 +335,7 @@ private function unreached(HitAndRun $hitAndRun, array $setting, $disableUser =
'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),
Expand Down
2 changes: 1 addition & 1 deletion include/constants.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.7');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-09-20');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-09-21');
defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
Expand Down
4 changes: 2 additions & 2 deletions public/announce.php
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,9 @@
if ($snatchInfo['downloaded'] >= $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");
Expand Down

0 comments on commit ab517bf

Please sign in to comment.