Skip to content

Commit

Permalink
bug in model name handling fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgirard committed Sep 6, 2017
1 parent 3005100 commit 908f962
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/routes/editLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ function getEditLog(req, res){
},
(whoIds, next) =>{
// build the mongo query to editLog collection
model = _.capitalize(model)
const mongoQuery = {model}
const mongoModel = model === 'people' ? 'People' : (model === 'organizations' ? 'Organization' : 'Activity')
const mongoQuery = {model: mongoModel }
if (itemID)
mongoQuery.item = ObjectId(itemID)

Expand Down Expand Up @@ -137,7 +137,7 @@ function getEditLog(req, res){
as: 'creator'
}},
{'$lookup':{
from: model === 'People' ? 'people' : (model === 'Organization' ? 'organizations' : 'activities'),
from: model === 'people' ? 'people' : (model === 'organizations' ? 'organizations' : 'activities'),
localField: 'item',
foreignField: '_id',
as: 'itemObject'
Expand Down Expand Up @@ -233,7 +233,7 @@ function getEditLog(req, res){
}

function formatItemName(data, model){
if (model === 'People' && data){
if (model === 'people' && data){
return (data.firstName ? data.firstName+' ': '')+ data.name
}
else
Expand Down

0 comments on commit 908f962

Please sign in to comment.