From f007adf9658eb1fd095c2716e4146130535f6cb7 Mon Sep 17 00:00:00 2001 From: Miguel Ribeiro Date: Thu, 31 Oct 2024 15:32:36 +0100 Subject: [PATCH] feat: only show filters that are actually used feat: link version update banner to github release fix: filters for categories and payment method respect order from settings --- includes/getdbkeys.php | 5 ++++- includes/version.php | 2 +- index.php | 32 ++++++++++++++++++++++----- stats.php | 50 ++++++++++++++++++++++++++++++------------ styles/dark-theme.css | 4 ++++ styles/styles.css | 5 +++++ 6 files changed, 77 insertions(+), 21 deletions(-) diff --git a/includes/getdbkeys.php b/includes/getdbkeys.php index 2130024d8..ac7dd20a7 100644 --- a/includes/getdbkeys.php +++ b/includes/getdbkeys.php @@ -18,16 +18,18 @@ while ($row = $result->fetchArray(SQLITE3_ASSOC)) { $memberId = $row['id']; $members[$memberId] = $row; + $members[$memberId]['count'] = 0; } $payment_methods = array(); - $query = $db->prepare("SELECT * FROM payment_methods WHERE enabled=:enabled AND user_id = :userId"); + $query = $db->prepare("SELECT * FROM payment_methods WHERE enabled=:enabled AND user_id = :userId ORDER BY `order` ASC"); $query->bindValue(':enabled', 1, SQLITE3_INTEGER); $query->bindValue(':userId', $userId, SQLITE3_INTEGER); $result = $query->execute(); while ($row = $result->fetchArray(SQLITE3_ASSOC)) { $payment_methodId = $row['id']; $payment_methods[$payment_methodId] = $row; + $payment_methods[$payment_methodId]['count'] = 0; } $categories = array(); @@ -38,6 +40,7 @@ while ($row = $result->fetchArray(SQLITE3_ASSOC)) { $categoryId = $row['id']; $categories[$categoryId] = $row; + $categories[$categoryId]['count'] = 0; } $cycles = array(); diff --git a/includes/version.php b/includes/version.php index 0d3cc936b..c9232b068 100644 --- a/includes/version.php +++ b/includes/version.php @@ -1,3 +1,3 @@ \ No newline at end of file diff --git a/index.php b/index.php index a72ea394c..6dbe32035 100644 --- a/index.php +++ b/index.php @@ -121,6 +121,15 @@ } } +foreach ($subscriptions as $subscription) { + $memberId = $subscription['payer_user_id']; + $members[$memberId]['count']++; + $categoryId = $subscription['category_id']; + $categories[$categoryId]['count']++; + $paymentMethodId = $subscription['payment_method_id']; + $payment_methods[$paymentMethodId]['count']++; +} + $headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden"; ?>