Tell us what’s happening:
Hi, I have been working on this project for a while know and have been comparing my results the functionally similar project given and i get the same results, but when I submit my review project I still don’t pass the test case. So im not sure where to go from here. Any help would be appreciated. Thank you.
Your code so far
type or paste code here
logData = d.userInfo[0].log;
const log = {
_id: d.userId,
username: d.userInfo[0].username,
count: parseInt(logData.length),
}
if(d.from){
console.log("From");
date = new Date(d.from);
logData = logData.filter(exer => (new Date(exer.date)).getTime() >= date.getTime());
d.from = d.from.split("-");
d.fromDate = new Date(d.from[0], (parseInt(d.from[1])-1).toString(), d.from[2]);
d.from = (d.fromDate.toString()).split(" ");
d.fromDate = `${d.from[0]} ${d.from[1]} ${d.from[2]} ${d.from[3]}`;
log["from"] = d.fromDate;
console.log(logData);
}
if(d.to){
console.log("To");
d.to = d.to.split("-");
d.toDate = new Date(d.to[0], (parseInt(d.to[1])-1).toString(), d.to[2]);
d.to = (d.toDate.toString()).split(" ");
d.toDate = `${d.to[0]} ${d.to[1]} ${d.to[2]} ${d.to[3]}`;
for(var i=(logData.length - 1); i > -1; i--){
if(logData[i].date == d.toDate) break;
logData.pop();
}
log["to"] = d.toDate;
}
// logData = logData.reverse();
if(d.limit){
console.log("Lim");
logData = logData.slice(0, d.limit);
}
log.count = parseInt(logData.length);
log["log"] = logData;
res.json(log)
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36
.
Challenge: Exercise Tracker
Link to the challenge: