Exercise tracking: last tests not passing

Well,

it tests ok for me regarding the functionality but the “logs” tests are failing.
I thought it was because of date formatting but apparently, it is not(?)
Any help, please? :frowning:

Your project link(s)

solution: https://replit.com/@ranran2121/boilerplate-project-exercisetracker-1

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36

Challenge: Exercise Tracker

Link to the challenge:

  1. When I try to add an exercise without a date, it assigns the date to “invalid date”, which is not we want.

  2. You did not fully handle the situation when a user sends a “to date”.

  3. You tried to filter for “from date” everytime, even the times user does not send a “from date”.

Thanks for your assistance
I fixed the first point and rearranged the code so to run the filter only if there are from/to/limit queries in the url.
Again the outputs look ok to me
this is a sample

/api/users/60b7c2fb978d3d0527b817f8/logs?limit=3
output
{"_id":"60b7c2fb978d3d0527b817f8","username":"ranran","count":3,"log":[{"description":"rada","duration":44,"date":"Thu Jun 03 2021"},{"description":"mini","duration":144,"date":"Tue Feb 21 2012"},{"description":"ermi","duration":44,"date":"Tue Feb 21 2012"}]}
https://boilerplate-project-exercisetracker-1.ranran2121.repl.co/api/users/60b7c2fb978d3d0527b817f8/logs?from=2011-01-01&to=2021-06-03
output
{"_id":"60b7c2fb978d3d0527b817f8","username":"ranran","from":"Sat Jan 01 2011","to":"Thu Jun 03 2021","count":4,"log":[{"description":"mini","duration":144,"date":"Tue Feb 21 2012"},{"description":"ermi","duration":44,"date":"Tue Feb 21 2012"},{"description":"arya","duration":23,"date":"Tue Feb 21 2012"},{"description":"athos","duration":12,"date":"Tue Feb 21 2012"}]}
https://boilerplate-project-exercisetracker-1.ranran2121.repl.co/api/users/60b7c2fb978d3d0527b817f8/logs?to=2021-06-03
output
{"_id":"60b7c2fb978d3d0527b817f8","username":"ranran","to":"Thu Jun 03 2021","count":4,"log":[{"description":"mini","duration":144,"date":"Tue Feb 21 2012"},{"description":"ermi","duration":44,"date":"Tue Feb 21 2012"},{"description":"arya","duration":23,"date":"Tue Feb 21 2012"},{"description":"athos","duration":12,"date":"Tue Feb 21 2012"}]}
https://boilerplate-project-exercisetracker-1.ranran2121.repl.co/api/users/60b7c2fb978d3d0527b817f8/logs?to=2021-06-03
output
{"_id":"60b7c2fb978d3d0527b817f8","username":"ranran","to":"Thu Jun 03 2021","count":5,"log":[{"description":"rada","duration":44,"date":"Thu Jun 03 2021"},{"description":"mini","duration":144,"date":"Tue Feb 21 2012"},{"description":"ermi","duration":44,"date":"Tue Feb 21 2012"},{"description":"arya","duration":23,"date":"Tue Feb 21 2012"},{"description":"athos","duration":12,"date":"Tue Feb 21 2012"}]}

Am I missing something else?

UPDATE
solved :slight_smile:
the error was in the “exercise” part since I was not saving after adding logs.
Yesterday I lost of the code and when I wrote everything from scratch i forgot to save the user after adding an exercise. Everything else was working since I was using the same database that had a collection of logs from previous code :slight_smile:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.