Tell us what’s happening:
Hello All,
The following tests failed:
-
test 5: You can make a
GET
request to/api/exercise/log
with a parameter ofuserId=_id
to retrieve a full exercise log of any user. The returned response will be the user object with alog
array of all the exercises added. Each log item has thedescription
,duration
, anddate
properties. -
test 6: A request to a user’s log (
/api/exercise/log
) returns an object with acount
property representing the number of exercises returned.
Here is my test output for these tests:
// GET /api/exercise/log?userId=604c70ee41091601ca5a72bb
{"_id":"604c70ee41091601ca5a72bb","username":"nesta1","count":2,"log":[{"description":"exercise 1","duration":10,"date":"Sat Mar 13 2021"},{"description":"exercise 1","duration":20,"date":"Sat Mar 13 2021"}]}
Here is the test output from the FreeCodeCamp example (https://exercise-tracker.freecodecamp.rocks/):
// GET /api/exercise/log?userId=6045e4e56c1ac605e6029037
{"_id":"6045e4e56c1ac605e6029037","username":"nesta8","count":5,"log":[{"description":"exercise 1","duration":1,"date":"Fri Jan 01 2021"},{"description":"exercise 1","duration":1,"date":"Fri Jan 01 2021"},{"description":"exercise 2","duration":1,"date":"Fri Jan 01 2021"},{"description":"exercise 2","duration":2,"date":"Fri Jan 01 2021"},{"description":"test","duration":10,"date":"Tue Oct 10 2000"}]}
Both outputs are similar.
Test 7 is a pass. How can it pass and test 5 and 6 fail?
You can add from
, to
and limit
parameters to a /api/exercise/log
request to retrieve part of the log of any user. from
and to
are dates in yyyy-mm-dd
format. limit
is an integer of how many logs to send back.
Your project link(s)
solution: https://boilerplate-project-exercisetracker.stephaneramael.repl.co
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36
.
Challenge: Exercise Tracker
Link to the challenge:
Many thanks in advance,