diff --git a/NickvisionMoney.GNOME/Program.cs b/NickvisionMoney.GNOME/Program.cs index 2b9af08a4..d345e4730 100644 --- a/NickvisionMoney.GNOME/Program.cs +++ b/NickvisionMoney.GNOME/Program.cs @@ -42,13 +42,9 @@ public Program(string[] args) _mainWindow = null; _mainWindowController = new MainWindowController(args); _mainWindowController.AppInfo.Changelog = - @"* Disallowed whitespace-only group and account names - * Fixed an issue where exported PDF values were incorrect - * Fixed an issue where some system cultures were not read properly - * Fixed an issue where scrolling the sidebar with the mouse over the calendar would scroll the calendar instead - * Fixed an issue where leading or trailing spaces in group/account names aren't discarded - * Updated to GNOME 45 runtime with latest libadwaita design - * Updated to .NET 8.0 + @"* Fixed an issue where the generated ids of new transactions were incorrect. + * Fixed an issue that caused sort to behave inconsistently. + * Fixed calendar not showing marks for transactions after pressing the ""Today"" button. * Updated and added translations (Thanks to everyone on Weblate)!"; _application.OnActivate += OnActivate; if (File.Exists(Path.GetFullPath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)) + "/org.nickvision.money.gresource")) diff --git a/NickvisionMoney.GNOME/Views/AccountView.cs b/NickvisionMoney.GNOME/Views/AccountView.cs index 2b94bd12f..9ee7c3bfc 100644 --- a/NickvisionMoney.GNOME/Views/AccountView.cs +++ b/NickvisionMoney.GNOME/Views/AccountView.cs @@ -1241,6 +1241,7 @@ private void OnSelectCurrentMonth(Gtk.Button sender, EventArgs e) private void OnResetCalendarFilter(Gtk.Button sender, EventArgs e) { gtk_calendar_select_day(_calendar.Handle, ref g_date_time_new_now_local()); + OnCalendarMonthYearChanged(null, e); _rangeExpander.SetEnableExpansion(false); } diff --git a/NickvisionMoney.Shared/Controllers/AccountViewController.cs b/NickvisionMoney.Shared/Controllers/AccountViewController.cs index fe3f2181a..253eaa577 100644 --- a/NickvisionMoney.Shared/Controllers/AccountViewController.cs +++ b/NickvisionMoney.Shared/Controllers/AccountViewController.cs @@ -411,12 +411,18 @@ private int SortTransactions(uint a, uint b) else if (SortTransactionsBy == SortBy.Date) { compareTo = _account.Transactions[a].Date.CompareTo(_account.Transactions[b].Date); + compareTo = compareTo == 0 ? a.CompareTo(b) : compareTo; } else if (SortTransactionsBy == SortBy.Amount) { var aAmount = _account.Transactions[a].Amount * (_account.Transactions[a].Type == TransactionType.Income ? 1m : -1m); var bAmount = _account.Transactions[b].Amount * (_account.Transactions[b].Type == TransactionType.Income ? 1m : -1m); - compareTo = aAmount.CompareTo(bAmount); + compareTo = aAmount.CompareTo(bAmount); + if (compareTo == 0) + { + compareTo = _account.Transactions[a].Date.CompareTo(_account.Transactions[b].Date); + compareTo = compareTo == 0 ? a.CompareTo(b) : compareTo; + } } if (!SortFirstToLast) { @@ -628,15 +634,7 @@ public async Task AddTransactionAsync(Transaction transaction) if (res.Successful) { var transactions = _account.Transactions.Keys.ToList(); - transactions.Sort((a, b) => - { - var compareTo = SortTransactionsBy == SortBy.Date ? _account.Transactions[a].Date.CompareTo(_account.Transactions[b].Date) : a.CompareTo(b); - if (!SortFirstToLast) - { - compareTo *= -1; - } - return compareTo; - }); + transactions.Sort(SortTransactions); for (var i = 0; i < transactions.Count; i++) { if (transactions[i] == transaction.Id) diff --git a/NickvisionMoney.Shared/Controllers/MainWindowController.cs b/NickvisionMoney.Shared/Controllers/MainWindowController.cs index fb865e4a1..094a8a2e4 100644 --- a/NickvisionMoney.Shared/Controllers/MainWindowController.cs +++ b/NickvisionMoney.Shared/Controllers/MainWindowController.cs @@ -86,7 +86,7 @@ public MainWindowController(string[] args) Directory.Delete($"{UserDirectories.Config}{Path.DirectorySeparatorChar}Nickvision{Path.DirectorySeparatorChar}{AppInfo.Name}", true); } Aura.Active.SetConfig("config"); - AppInfo.Version = "2023.11.0"; + AppInfo.Version = "2023.12.0-next"; AppInfo.ShortName = _("Denaro"); AppInfo.Description = _("Manage your personal finances"); AppInfo.SourceRepo = new Uri("https://github.com/NickvisionApps/Denaro"); diff --git a/NickvisionMoney.Shared/Linux/org.nickvision.money.metainfo.xml.in b/NickvisionMoney.Shared/Linux/org.nickvision.money.metainfo.xml.in index 431694773..7ea1881d1 100644 --- a/NickvisionMoney.Shared/Linux/org.nickvision.money.metainfo.xml.in +++ b/NickvisionMoney.Shared/Linux/org.nickvision.money.metainfo.xml.in @@ -47,15 +47,11 @@ application/x-nmoney - + -

- Disallowed whitespace-only group and account names

-

- Fixed an issue where exported PDF values were incorrect

-

- Fixed an issue where some system cultures were not read properly

-

- Fixed an issue where scrolling the sidebar with the mouse over the calendar would scroll the calendar instead

-

- Fixed an issue where leading or trailing spaces in group/account names aren't discarded

-

- Updated to GNOME 45 runtime with latest libadwaita design

-

- Updated to .NET 8.0

+

- Fixed an issue where the generated ids of new transactions were incorrect.

+

- Fixed an issue that caused sort to behave inconsistently.

+

- Fixed calendar not showing marks for transactions after pressing the "Today" button.

- Updated translations (Thanks to everyone on Weblate)!

diff --git a/NickvisionMoney.Shared/Models/Account.cs b/NickvisionMoney.Shared/Models/Account.cs index 55df4df45..83a7825b3 100644 --- a/NickvisionMoney.Shared/Models/Account.cs +++ b/NickvisionMoney.Shared/Models/Account.cs @@ -1012,7 +1012,14 @@ public async Task DeleteTransactionAsync(uint id) Transactions.Remove(id); if (id + 1 == NextAvailableTransactionId) { - NextAvailableTransactionId--; + if(Transactions.Count == 0) + { + NextAvailableTransactionId = 1; + } + else + { + NextAvailableTransactionId = Transactions.Max(x => x.Key) + 1; + } } BackupAccountToCSV(); return true;