mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-24 03:59:08 -05:00
fix: history updates
Only update the history updated_at column on announces
This commit is contained in:
@@ -17,6 +17,7 @@ use App\Models\History;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* @see \Tests\Unit\Console\Commands\AutoCorrectHistoryTest
|
||||
@@ -44,13 +45,13 @@ class AutoCorrectHistory extends Command
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$carbon = new Carbon();
|
||||
$history = History::select(['id', 'active', 'updated_at'])->where('active', '=', 1)->where('updated_at', '<', $carbon->copy()->subHours(2)->toDateTimeString())->get();
|
||||
|
||||
foreach ($history as $h) {
|
||||
$h->active = false;
|
||||
$h->save();
|
||||
}
|
||||
History::select(['id', 'active', 'updated_at'])
|
||||
->where('active', '=', 1)
|
||||
->where('updated_at', '<', Carbon::now()->subHours(2)->toDateTimeString())
|
||||
->update([
|
||||
'active' => 0,
|
||||
'updated_at' => DB::raw('updated_at'),
|
||||
]);
|
||||
|
||||
$this->comment('Automated History Record Correction Command Complete');
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ class AutoFlushPeers extends Command
|
||||
$history = History::where('torrent_id', '=', $peer->torrent_id)->where('user_id', '=', $peer->user_id)->first();
|
||||
if ($history) {
|
||||
$history->active = false;
|
||||
$history->timestamps = false;
|
||||
$history->save();
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ class AutoPreWarning extends Command
|
||||
|
||||
// Set History Prewarn
|
||||
$pre->prewarn = 1;
|
||||
$pre->timestamps = false;
|
||||
$pre->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ class AutoWarning extends Command
|
||||
// Send Notifications
|
||||
$hr->user->notify(new UserWarning($hr->user, $hr->torrent));
|
||||
|
||||
$hr->timestamps = false;
|
||||
$hr->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ class FlushController extends Controller
|
||||
$history = History::where('torrent_id', '=', $peer->torrent_id)->where('user_id', '=', $peer->user_id)->first();
|
||||
if ($history) {
|
||||
$history->active = false;
|
||||
$history->timestamps = false;
|
||||
$history->save();
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,12 @@ class PeerController extends Controller
|
||||
->delete();
|
||||
|
||||
$user->history()
|
||||
->where('active', '=', 1)
|
||||
->where('updated_at', '<', $cutoff)
|
||||
->update(['active' => false]);
|
||||
->update([
|
||||
'active' => 0,
|
||||
'updated_at' => DB::raw('updated_at'),
|
||||
]);
|
||||
|
||||
$user->own_flushes--;
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
<th>{{ __('common.download') }}</th>
|
||||
<th>{{ __('common.added') }}</th>
|
||||
<th>{{ __('torrent.last-update') }}</th>
|
||||
<th>{{ __('torrent.completed_at') }}</th>
|
||||
<th>{{ __('torrent.seedtime') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -98,6 +99,11 @@
|
||||
{{ $history->updated_at ? $history->updated_at->diffForHumans() : 'N/A' }}
|
||||
</time>
|
||||
</td>
|
||||
<td>
|
||||
<time datetime="{{ $history->completed_at }}" title="{{ $history->completed_at }}">
|
||||
{{ $history->completed_at ? $history->completed_at->diffForHumans() : 'N/A' }}
|
||||
</time>
|
||||
</td>
|
||||
@if ($history->seedtime < config('hitrun.seedtime'))
|
||||
<td class="text-red">{{ App\Helpers\StringHelper::timeElapsed($history->seedtime) }}</td>
|
||||
@else
|
||||
|
||||
Reference in New Issue
Block a user