Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Change the original model while saving an order #421

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ public override async Task SaveChangesAsync(IList<CustomerOrder> models)
// VP-5561: Need to fill changedEntries newEntry with the models built from saved entities (with the info filled when saving to database)
foreach (var (changedEntry, i) in changedEntries.Select((x, i) => (x, i)))
{
var changedModel = changedEntities[i].ToModel(AbstractTypeFactory<CustomerOrder>.TryCreateInstance());
// Here the original model from models parameter
var changedModel = changedEntities[i].ToModel(changedEntry.NewEntry);

// We need to CalculateTotals for the new Order, because it is empty after entity.ToModel creation
_totalsCalculator.CalculateTotals(changedModel);
Expand Down
Loading