Skip to content

Commit

Permalink
only startDate make a precise query now
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgirard committed Sep 8, 2017
1 parent 6f7abe8 commit c86ef7b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions server/routes/editLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,16 @@ function getEditLog(req, res){
mongoQuery['action'] = query.action

//dates
if (query.startDate)
mongoQuery['date'] = {'$gte': new Date(fillIncompleteDate(query.startDate, true))}
if (query.startDate){
const sd = new Date(fillIncompleteDate(query.startDate, true))
mongoQuery['date'] = {'$gte': sd}
if (!query.endDate) {
const ed = new Date(sd.getTime())
ed.setHours(23)
ed.setMinutes(59)
mongoQuery['date']['$lte'] = sd
}
}

if (query.endDate){
const endDate = new Date(fillIncompleteDate(query.endDate, false))
Expand All @@ -251,6 +259,9 @@ function getEditLog(req, res){
else
mongoQuery['date']= {'$lte': endDate}
}



debug('Query', mongoQuery)
let aggregationPipeline = [
{'$match':mongoQuery},
Expand Down

0 comments on commit c86ef7b

Please sign in to comment.