Skip to content

Commit

Permalink
Fixed additional partial application updates (#498)
Browse files Browse the repository at this point in the history
Co-authored-by: Ivan Lieckens <[email protected]>
  • Loading branch information
sc-ivanlieckens and IvanLieckens authored Nov 29, 2024
1 parent 755bdea commit 484c8e0
Showing 1 changed file with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,9 @@ private async Task ExecuteMvpTypeStep(ApplicationFormModel model)
{
if (model.CurrentApplication != null)
{
Application updateApplication = new(model.CurrentApplication.Id)
{
MvpType = new MvpType(model.MvpTypeId)
};
model.CurrentApplication.MvpType = new MvpType(model.MvpTypeId);
Response<Application> applicationResponse =
await Client.UpdateApplicationAsync(updateApplication);
await Client.UpdateApplicationAsync(model.CurrentApplication);
if (applicationResponse is { StatusCode: HttpStatusCode.OK, Result: not null })
{
model.CurrentApplication = applicationResponse.Result;
Expand Down Expand Up @@ -364,16 +361,13 @@ private async Task ExecuteMvpTypeStep(ApplicationFormModel model)

private async Task ExecuteObjectivesStep(ApplicationFormModel model)
{
if (model.IsNavigation.HasValue && !model.IsNavigation.Value && !string.IsNullOrWhiteSpace(model.Eligibility) && !string.IsNullOrWhiteSpace(model.Objectives))
if (model.IsNavigation.HasValue && !model.IsNavigation.Value && !string.IsNullOrWhiteSpace(model.Eligibility) && !string.IsNullOrWhiteSpace(model.Objectives) && model.CurrentApplication != null)
{
Application updateApplication = new(model.CurrentApplication!.Id)
{
Eligibility = model.Eligibility,
Objectives = model.Objectives,
Mentor = model.Mentors
};
model.CurrentApplication.Eligibility = model.Eligibility;
model.CurrentApplication.Objectives = model.Objectives;
model.CurrentApplication.Mentor = model.Mentors;
Response<Application> applicationResponse =
await Client.UpdateApplicationAsync(updateApplication);
await Client.UpdateApplicationAsync(model.CurrentApplication);
if (applicationResponse is { StatusCode: HttpStatusCode.OK, Result: not null })
{
model.CurrentApplication = applicationResponse.Result;
Expand Down Expand Up @@ -568,13 +562,10 @@ private async Task ExecuteConfirmationStep(ApplicationFormModel model)

private async Task ExecuteSubmittedStep(ApplicationFormModel model)
{
if (model.IsNavigation.HasValue && !model.IsNavigation.Value)
if (model.IsNavigation.HasValue && !model.IsNavigation.Value && model.CurrentApplication != null)
{
Application updateApplication = new(model.CurrentApplication!.Id)
{
Status = ApplicationStatus.Open
};
Response<Application> applicationResponse = await Client.UpdateApplicationAsync(updateApplication);
model.CurrentApplication.Status = ApplicationStatus.Open;
Response<Application> applicationResponse = await Client.UpdateApplicationAsync(model.CurrentApplication);
if (applicationResponse is { StatusCode: HttpStatusCode.OK, Result: not null })
{
model.CurrentApplication = applicationResponse.Result;
Expand Down

0 comments on commit 484c8e0

Please sign in to comment.