Open
Conversation
sushiat
requested changes
Nov 29, 2023
Member
sushiat
left a comment
There was a problem hiding this comment.
If you want to further expand this to a full account reset here a few things coming to mind:
- Make sure all aircraft are on the ground at least - no active flights, maintenance (not yet fully added) shouldn't matter
- Make sure the user isn't the primary owner of an airline, again don't have that yet fully implemented but the airline model has a FounderID. In the long term the airline will have to be transferred to another user or formally dissolved - whatever that will look like. But refuse to do a reset for an active airline founder.
- Not sure about rented aircraft yet - again not fully implemented. The idea was that you either have to return it or pay for the return to origin.
- All player owned aircraft get returned to the system, custom stuff like aircraft name get removed and variant aircraft changed back to base version.
| Timestamp = DateTime.UtcNow, | ||
| UserID = user.Id, | ||
| Category = FinancialCategory.None, | ||
| Expense = user.PersonalAccountBalance - user.PersonalAccountBalance, |
Member
There was a problem hiding this comment.
That will just set the Expense to 0, just set user.PersonalAccountBalance here
| }; | ||
| await this.db.FinancialRecords.AddAsync(resetRecord); | ||
|
|
||
| var saveEx = await this.db.SaveDatabaseChangesAsync(this.logger, "Failed to reset funds"); |
Member
There was a problem hiding this comment.
Before saving the changes you also need to actually adjust the user's balance. The financial record above is just the trace record of what happened.
user.PersonalAccountBalance = 0;
| /// Damir, 29/11/2023 | ||
| /// </remarks> | ||
| /// <returns> | ||
| /// An asynchronous result that yields the account balances. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
API endpoint to reset a users funds
Feel like it would be a good option to have.