Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.
Remove duplicate category. Fix changing main currency. Fix currency conversion. Pre-Select main currency when adding a new subscription.
ellite7e4ca238111a
diff --git a/db/commands.sql b/db/commands.sqlindex 65fd66f..ca22d4f 100644--- a/db/commands.sql+++ b/db/commands.sql@@ -108,7 +108,7 @@ INSERT INTO categories (id, name) VALUES(11, 'Insurance'),(12, 'Gaming'),(13, 'News & Magazines'),- (14, 'Productivity'),+ (14, 'Software'),(15, 'Technology'),(16, 'Charity & Donations:');diff --git a/endpoints/cronjobs/createdatabase.php b/endpoints/cronjobs/createdatabase.phpindex d0140ac..4fd6c15 100644--- a/endpoints/cronjobs/createdatabase.php+++ b/endpoints/cronjobs/createdatabase.php@@ -119,7 +119,7 @@ if (!file_exists($databaseFile)) {(11, 'Insurance'),(12, 'Gaming'),(13, 'News & Magazines'),- (14, 'Productivity'),+ (14, 'Software'),(15, 'Technology'),(16, 'Cloud Services'),(17, 'Charity & Donations')");diff --git a/endpoints/user/save_user.php b/endpoints/user/save_user.phpindex 808f9dd..e13f086 100644--- a/endpoints/user/save_user.php+++ b/endpoints/user/save_user.php@@ -27,7 +27,7 @@$mainCurrencyCode = $row['code'];$mainCurrencyId = $row['main_currency'];- $api_url = "http://data.fixer.io/api/latest?access_key=". $apiKey . "&base=" . $mainCurrencyCode . "&symbols=" . $codes;+ $api_url = "http://data.fixer.io/api/latest?access_key=". $apiKey . "&base=EUR&symbols=" . $codes;$response = file_get_contents($api_url);$apiData = json_decode($response, true);@@ -131,6 +131,7 @@$_SESSION['avatar'] = $avatar;if ($main_currency != $mainCurrencyId) {+ $_SESSION['main_currency'] = $main_currency;update_exchange_rate($db);}diff --git a/includes/list_subscriptions.php b/includes/list_subscriptions.phpindex 5edca6a..bdeb423 100644--- a/includes/list_subscriptions.php+++ b/includes/list_subscriptions.php@@ -50,7 +50,7 @@return $price;} else {$fromRate = $exchangeRate['rate'];- return number_format($price * $fromRate, 2);+ return number_format($price / $fromRate, 2);}}diff --git a/index.php b/index.phpindex 041923f..3402c23 100644--- a/index.php+++ b/index.php@@ -147,8 +147,9 @@<select id="currency" name="currency_id" placeholder="Currency"><?phpforeach ($currencies as $currency) {+ $selected = ($currency['id'] == $main_currency) ? 'selected' : '';?>- <option value="<?= $currency['id'] ?>"><?= $currency['name'] ?></option>+ <option value="<?= $currency['id'] ?>" <?= $selected ?>><?= $currency['name'] ?></option><?php}?>