Optimize queries for statistics.

This commit is contained in:
James Cole
2025-09-26 06:05:37 +02:00
parent 08879d31ba
commit 4ec2fcdb8a
92 changed files with 6499 additions and 6514 deletions

View File

@@ -23,9 +23,9 @@ declare(strict_types=1);
namespace FireflyIII\Support;
use Illuminate\Database\Eloquent\Model;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Support\Form\FormSupport;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Throwable;
@@ -43,7 +43,7 @@ class ExpandedForm
*/
public function amountNoCurrency(string $name, $value = null, ?array $options = null): string
{
$options ??= [];
$options ??= [];
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
@@ -74,8 +74,8 @@ class ExpandedForm
*/
public function checkbox(string $name, ?int $value = null, $checked = null, ?array $options = null): string
{
$options ??= [];
$value ??= 1;
$options ??= [];
$value ??= 1;
$options['checked'] = true === $checked;
if (app('session')->has('preFilled')) {
@@ -83,10 +83,10 @@ class ExpandedForm
$options['checked'] = $preFilled[$name] ?? $options['checked'];
}
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
$value = $this->fillFieldValue($name, $value);
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
$value = $this->fillFieldValue($name, $value);
unset($options['placeholder'], $options['autocomplete'], $options['class']);
@@ -157,10 +157,10 @@ class ExpandedForm
public function integer(string $name, $value = null, ?array $options = null): string
{
$options ??= [];
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
$value = $this->fillFieldValue($name, $value);
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
$value = $this->fillFieldValue($name, $value);
$options['step'] ??= '1';
try {
@@ -209,9 +209,9 @@ class ExpandedForm
/** @var Model $entry */
foreach ($set as $entry) {
// All Eloquent models have an ID
$entryId = $entry->id;
$current = $entry->toArray();
$title = null;
$entryId = $entry->id;
$current = $entry->toArray();
$title = null;
foreach ($fields as $field) {
if (array_key_exists($field, $current) && null === $title) {
$title = $current[$field];