From 4a81b7044ea6477c115dfc9326961974bd745ef8 Mon Sep 17 00:00:00 2001 From: Hyleus Date: Fri, 15 Dec 2017 18:07:57 +0100 Subject: [PATCH 1/4] Display the amount that can still be downloaded. This adds a line of text that displays the amount until the user falls under the required ratio. --- app/User.php | 13 +++++++++++++ resources/views/torrent/download_check.blade.php | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/app/User.php b/app/User.php index 463c9f09b7..f9bc3b65f8 100755 --- a/app/User.php +++ b/app/User.php @@ -24,6 +24,7 @@ use Illuminate\Contracts\Auth\CanResetPassword; use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; +use function theodorejb\polycast\to_int; use App\Helpers\StringHelper; @@ -383,6 +384,18 @@ public function ratioAfterSizeString($size, $freeleech = false) } } + // Return the size (pretty formated) which can be safely downloaded + // without falling under the minimum ratio. + public function untilRatio($ratio) + { + if ($ratio == 0.0) { + return "∞"; + } + + $bytes = to_int($this->uploaded / $ratio); + return StringHelper::formatBytes($bytes); + } + /** * Returns the HTML of the user's signature * diff --git a/resources/views/torrent/download_check.blade.php b/resources/views/torrent/download_check.blade.php index 8fd8fd6ae5..0b97aabdc2 100644 --- a/resources/views/torrent/download_check.blade.php +++ b/resources/views/torrent/download_check.blade.php @@ -71,6 +71,10 @@ @endif
+
+ You can still download {{ $user->untilRatio(config('other.ratio')) }} bytes until you fall under the required ratio ({{ config('other.ratio')}}). +
+
@if($user->getRatio() < config('other.ratio') || $user->can_download == 0) Please Solve The Failed Results Above For Download Button To Appear From bdba707510a917d95cac45fd47dd6c95184f1aab Mon Sep 17 00:00:00 2001 From: Hyleus Date: Fri, 15 Dec 2017 18:33:41 +0100 Subject: [PATCH 2/4] Fix the message in the download check pages --- resources/views/torrent/download_check.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/torrent/download_check.blade.php b/resources/views/torrent/download_check.blade.php index 0b97aabdc2..afbb4a3012 100644 --- a/resources/views/torrent/download_check.blade.php +++ b/resources/views/torrent/download_check.blade.php @@ -72,7 +72,7 @@

- You can still download {{ $user->untilRatio(config('other.ratio')) }} bytes until you fall under the required ratio ({{ config('other.ratio')}}). + You can still download {{ $user->untilRatio(config('other.ratio')) }} until you fall under the required ratio ({{ config('other.ratio')}}).

From 0323deea1ab91361c6a4fe64d8c141f7bf3e8012 Mon Sep 17 00:00:00 2001 From: Hyleus Date: Fri, 15 Dec 2017 19:09:15 +0100 Subject: [PATCH 3/4] Display the buffer amount in the header bar --- resources/lang/en/common.php | 3 ++- resources/views/layout/default.blade.php | 1 + resources/views/torrent/download_check.blade.php | 4 ---- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/resources/lang/en/common.php b/resources/lang/en/common.php index 245fb6eea9..a333cdc3af 100755 --- a/resources/lang/en/common.php +++ b/resources/lang/en/common.php @@ -36,5 +36,6 @@ 'results' => 'Results', 'contact' => 'Contact', 'about' => 'About Us', - 'community' => 'Community', + 'community' => 'Community', + 'buffer' => 'Buffer' ]; diff --git a/resources/views/layout/default.blade.php b/resources/views/layout/default.blade.php index a02f68d28e..3be2c6c09d 100755 --- a/resources/views/layout/default.blade.php +++ b/resources/views/layout/default.blade.php @@ -288,6 +288,7 @@
  • {{ trans('common.upload') }}: {{ Auth::user()->getUploaded() }}
  • {{ trans('common.download') }}: {{ Auth::user()->getDownloaded() }}
  • {{ trans('common.ratio') }}: {{ Auth::user()->getRatioString() }}
  • +
  • {{ trans('common.buffer') }}: {{ Auth::user()->untilRatio(config('other.ratio')) }}
  • Seeding: {{ Auth::user()->getSeeding() }}
  • diff --git a/resources/views/torrent/download_check.blade.php b/resources/views/torrent/download_check.blade.php index afbb4a3012..e93189e068 100644 --- a/resources/views/torrent/download_check.blade.php +++ b/resources/views/torrent/download_check.blade.php @@ -70,10 +70,6 @@ @else APPROVED @endif
    -
    -
    - You can still download {{ $user->untilRatio(config('other.ratio')) }} until you fall under the required ratio ({{ config('other.ratio')}}). -

    @if($user->getRatio() < config('other.ratio') || $user->can_download == 0) From 3dcfb71579b851d7f1eda0e5557a226a2d8f73ef Mon Sep 17 00:00:00 2001 From: HDVinnie Date: Fri, 15 Dec 2017 13:19:30 -0500 Subject: [PATCH 4/4] Update download_check.blade.php use
    over
    as HTML5 standard --- resources/views/torrent/download_check.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/torrent/download_check.blade.php b/resources/views/torrent/download_check.blade.php index e93189e068..8fd8fd6ae5 100644 --- a/resources/views/torrent/download_check.blade.php +++ b/resources/views/torrent/download_check.blade.php @@ -70,7 +70,7 @@ @else APPROVED @endif
    -
    +
    @if($user->getRatio() < config('other.ratio') || $user->can_download == 0) Please Solve The Failed Results Above For Download Button To Appear