mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-29 11:15:58 +00:00
fakeRenameFileOrFolder fixes
This commit is contained in:
@@ -96,7 +96,7 @@ class GenerateDemoSubscriptionContentCommand extends Command
|
||||
|
||||
$subscription->usages()->create([
|
||||
'metered_feature_id' => $bandwidthFeature->id,
|
||||
'quantity' => random_int(111, 999),
|
||||
'quantity' => random_int(111, 999) / 1000,
|
||||
'created_at' => now()->subDays($item),
|
||||
]);
|
||||
|
||||
@@ -109,7 +109,7 @@ class GenerateDemoSubscriptionContentCommand extends Command
|
||||
|
||||
$subscription->usages()->create([
|
||||
'metered_feature_id' => $storageFeature->id,
|
||||
'quantity' => random_int(1111, 3999),
|
||||
'quantity' => random_int(1111, 3999) / 1000,
|
||||
'created_at' => now()->subDays($item),
|
||||
]);
|
||||
}
|
||||
@@ -193,8 +193,8 @@ class GenerateDemoSubscriptionContentCommand extends Command
|
||||
],
|
||||
])->each(
|
||||
function ($transaction) use ($user, $plan) {
|
||||
$bandwidthUsage = random_int(1000, 12000);
|
||||
$storageUsage = random_int(300, 4900);
|
||||
$bandwidthUsage = random_int(1000, 12000) / 1000;
|
||||
$storageUsage = random_int(300, 4900) / 1000;
|
||||
$memberUsage = random_int(3, 20);
|
||||
|
||||
$user->transactions()->create([
|
||||
|
||||
@@ -12,22 +12,16 @@ class FormatUsageEstimatesAction
|
||||
->mapWithKeys(function ($estimate) use ($currency) {
|
||||
// Format usage
|
||||
$usage = match ($estimate['feature']) {
|
||||
'bandwidth', 'storage' => Metric::megabytes($estimate['usage'])->format(),
|
||||
'bandwidth', 'storage' => Metric::megabytes($estimate['usage'] * 1000)->format(),
|
||||
'flatFee' => intval($estimate['usage']) . ' ' . __('Pcs.'),
|
||||
'member' => intval($estimate['usage']) . ' ' . __('Mem.'),
|
||||
};
|
||||
|
||||
// Normalize units
|
||||
$amount = match ($estimate['feature']) {
|
||||
'bandwidth', 'storage' => $estimate['amount'] / 1000,
|
||||
'flatFee', 'member' => $estimate['amount'],
|
||||
};
|
||||
|
||||
return [
|
||||
$estimate['feature'] => [
|
||||
'feature' => $estimate['feature'],
|
||||
'amount' => $amount,
|
||||
'cost' => format_currency($amount, $currency),
|
||||
'amount' => $estimate['amount'],
|
||||
'cost' => format_currency($estimate['amount'], $currency),
|
||||
'usage' => $usage,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -38,8 +38,8 @@ class ReportUsageAction
|
||||
->where('user_id', $subscription->user->id)
|
||||
->sum('filesize');
|
||||
|
||||
// We count storage size in GB, e.g. 0.15 is 150mb
|
||||
$amount = $filesize / 1000000;
|
||||
// We count storage size in GB, e.g. 0.150 is 150mb
|
||||
$amount = $filesize / 1_000_000_000;
|
||||
|
||||
// Record storage capacity usage
|
||||
$subscription->recordUsage('storage', $amount);
|
||||
@@ -54,7 +54,7 @@ class ReportUsageAction
|
||||
->whereDate('created_at', today()->subDay())
|
||||
->first();
|
||||
|
||||
$amount = (($record->download ?? 0) + ($record->upload ?? 0)) / 1000000;
|
||||
$amount = (($record->download ?? 0) + ($record->upload ?? 0)) / 1_000_000_000;
|
||||
|
||||
// Record storage capacity usage
|
||||
$subscription->recordUsage('bandwidth', $amount);
|
||||
|
||||
Reference in New Issue
Block a user