Skip to content

Commit

Permalink
All - Fix Creating Repeat Transactions
Browse files Browse the repository at this point in the history
Closes #681

By doing `transactionsModified || await Add...`, if `transactionsModified` was already true, it would short-circuit and skip the `await Add` part and caused the issue.
  • Loading branch information
nlogozzo committed Sep 3, 2023
1 parent a693181 commit 42392c3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions NickvisionMoney.GNOME/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public Program(string[] args)
_mainWindowController.AppInfo.Changelog =
@"* Fixed an issue where choosing an Amount Display Style would crash the app
* Fixed an issue where transferring to another account would sometimes crash the app
* Fixed an issue where some repeat transactions would not be created
* 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"))
Expand Down
6 changes: 4 additions & 2 deletions NickvisionMoney.Shared/Models/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,14 +1148,16 @@ public async Task<bool> SyncRepeatTransactionsAsync()
}
foreach (var date in dates) //create missing repeat transactions
{
transactionsModified = transactionsModified || (await AddTransactionAsync(transaction.Repeat(NextAvailableTransactionId, date))).Successful;
var res = (await AddTransactionAsync(transaction.Repeat(NextAvailableTransactionId, date))).Successful;
transactionsModified = transactionsModified || res;
}
}
else if (transaction.RepeatFrom > 0) //delete repeat transactions if the date from the original transaction was changed to a smaller date
{
if (Transactions[(uint)transaction.RepeatFrom].RepeatEndDate < transaction.Date)
{
transactionsModified = transactionsModified || await DeleteTransactionAsync(transaction.Id);
var res = await DeleteTransactionAsync(transaction.Id);
transactionsModified = transactionsModified || res;
}
}
i++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<description translatable="no">
<p>- Fixed an issue where choosing an Amount Display Style would crash the app</p>
<p>- Fixed an issue where transferring to another account would sometimes crash the app</p>
<p>- Fixed an issue where some repeat transactions would not be created</p>
<p>- Updated translations (Thanks to everyone on Weblate)!</p>
</description>
</release>
Expand Down

0 comments on commit 42392c3

Please sign in to comment.