Skip to content

Commit

Permalink
Fixed author update after creating candidate (#168)
Browse files Browse the repository at this point in the history
* fixed author update after creating candidate

* renamed results
  • Loading branch information
mhinkie authored Nov 24, 2022
1 parent 20ca07c commit 1eca37f
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,18 @@ export class CandidateManagementDetailComponent implements OnInit, AfterViewInit
if (_user) first_author = _user.id;
})

this.candidateManagementService.createCandidate(this.candidate).subscribe(result => {
// call update for all additional authors
this.candidateManagementService.createCandidate(this.candidate).subscribe(createdCandidate => {
// call update for all additional authors using the newly created candidate
for(let author of authorlist) {
if(author.userId !== first_author) {
this.candidateManagementService.updateAuthorsCandidate(this.candidate, author).subscribe(result => {
this.candidate = result;
})
this.candidateManagementService.updateAuthorsCandidate(createdCandidate, author).subscribe(updatedCandidate => {
this.candidate = updatedCandidate;
});
}
}

this.router.navigate(['./candidate/detail', this.candidate.name]);
})
});
}

update() {
Expand Down

0 comments on commit 1eca37f

Please sign in to comment.