fix: handle empty candidate trait lists
Return empty JSON arrays from the API and normalize nullable values from older servers before rendering candidate match counts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
6969f79015
commit
fd06fbbb5d
4 changed files with 36 additions and 3 deletions
|
|
@ -66,9 +66,17 @@ func ParticipantToWeb(value servicemodel.Participant) webmodel.ParticipantRespon
|
|||
}
|
||||
|
||||
func CandidateToWeb(value servicemodel.CandidateMatch) webmodel.CandidateResponse {
|
||||
matched := value.Matched
|
||||
if matched == nil {
|
||||
matched = []string{}
|
||||
}
|
||||
missing := value.Missing
|
||||
if missing == nil {
|
||||
missing = []string{}
|
||||
}
|
||||
return webmodel.CandidateResponse{
|
||||
Participant: ParticipantToWeb(value.Participant), Score: value.Score,
|
||||
Matched: value.Matched, Missing: value.Missing,
|
||||
Matched: matched, Missing: missing,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue