fix price show when mazane is 0

This commit is contained in:
2026-06-29 11:27:23 +03:30
parent b0dacc2423
commit bedbea0ff1
2 changed files with 4 additions and 2 deletions
@@ -392,9 +392,10 @@ class ReportController extends Controller
if ($priceValue <= 0) {
$lastPrice = Price::latest()->first();
$storedPrice = $lastPrice ? (float) $lastPrice->price : 0.0;
$useFallback = $request->boolean('force_refresh') || $show_last_price;
if ($storedPrice > 30_000_000 && $useFallback) {
// fallback فقط با show_last_price تصمیم‌گیری می‌شود؛ force_refresh (تیک کران) نباید آن را override کند.
// آستانهٔ ثابت قبلی (۳۰ میلیون) برای طلا بود و محصولات ارزان‌تر مثل کاتد مس/نقره را اشتباهاً «بدون مظنه» می‌کرد.
if ($storedPrice > 0 && $show_last_price) {
$priceValue = $storedPrice;
$priceSource = 'database_last';
} else {