getUser(); $user = (new UserRepository())->getByLogin($auth_user['login']); $account_repo = new AccountRepository(); $accounts = $user ? $account_repo->getList('*', ['user_id' => $user->id, 'is_delete' => 0], '`order`') : []; $archived_accounts = $user ? $account_repo->getList('*', ['user_id' => $user->id, 'is_delete' => 1], 'title') : []; $total = array_sum(array_map( static fn ($account) => $account->include_in_total && $account->currency === 'RUB' ? (float)$account->summa : 0, $accounts ?: [] )); $month = (int)date('n'); $year = (int)date('Y'); $category_repo = new CategoryRepository(); $budget_repo = new BudgetRepository(); // Факта (реальных transactions) в проекте ещё нет — это отдельная будущая фича // (см. .claude/memory/бюджет_текущий_план.md), поэтому fact = 0 везде; прогресс-бары // покажут 0%, пока операции не появятся, и заполнятся сами без правки этого кода. $tree = $user ? $category_repo->getTree($user->id) : []; $plan_month = $user ? array_map( static fn ($months) => $months[$month]['plan_summ'] ?? 0.0, $budget_repo->getYear($user->id, $year) ) : []; return $this->render('index', [ 'user' => $auth_user, 'accounts' => $accounts ?: [], 'archived_accounts' => $archived_accounts ?: [], 'total' => $total, 'tree' => $tree, 'plan_month' => $plan_month, 'month' => $month, ]); } }