Skip to content

Commit

Permalink
resilient to bad WhoID in db
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgirard committed Sep 7, 2017
1 parent 382943b commit ac28090
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions server/routes/editLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,11 @@ function formatEdits(data, model){
data.forEach(d => {
const edit = {}
edit.who = {
id: d.whoID,
name: (d.creator[0].firstName ? d.creator[0].firstName+' ': '')+ d.creator[0].name,
roles: d.creator[0].isariAuthorizedCenters ?
id: d.whoID
}
if (d.creator.length){
edit.who.name = (d.creator[0].firstName ? d.creator[0].firstName+' ': '')+ d.creator[0].name
edit.who.roles = d.creator[0].isariAuthorizedCenters ?
d.creator[0].isariAuthorizedCenters.map(iac =>({lab:iac.organization,role:iac.isariRole})):
[]
}
Expand Down

0 comments on commit ac28090

Please sign in to comment.