I finished my exercises-tracker project, but cant pass the tests for /api/users/:_id/logs, the response have everything it needs to. I’ll leave a replit link below , if someone could help me out here, idk if logs should come from mongoose model also and be saved in mongodb. Filtering with dates and limiting results is present, test just shows “Test timed out”, because of previous tests failed I assume.
Something isn’t working. I just visited your site and tried to use the main form to create a new user and it isn’t redirecting me or giving me any feedback.
Thanks for suggestion, Im making mongoose model for exercise with date key and value type of Date, so I could use filtering later in logs api, for gte and lte. The instruction says that responses should have type of Date formated with toDateString method, which I did for every response in exercise api and logs api.
Exercise api response:
{“username”:“cirko”,“description”:“Press”,“duration”:15,“date”:“Wed Nov 30 2022”,“_id”:“6387d222b6c19c88ce904715”}
Logs api response:
{“username”:“cirko”,“count”:5,“_id”:“6387d222b6c19c88ce904715”,“log”:[{“description”:“Pushups”,“duration”:15,“date”:“Wed Nov 30 2022”},{“description”:“Pullups”,“duration”:30,“date”:“Thu Jan 01 2015”},{“description”:“Walking”,“duration”:45,“date”:“Mon Jan 01 2018”},{“description”:“Sleeping”,“duration”:500,“date”:“Fri Jan 01 2010”},{“description”:“Press”,“duration”:15,“date”:“Wed Nov 30 2022”}]}
Response from ‘api/users/63887fdd272e04ca6692e9e7/logs’: {“username”:“cirko”,“count”:1,“_id”:“63887fdd272e04ca6692e9e7”,“log”:[{“description”:“Pushups”,“duration”:15,“date”:“Thu Dec 01 2022”}]}
The count is 0 when there’s no exercises added, yes.
Response from ‘api/users/63887fdd272e04ca6692e9e7/exercises’ route: {“username”:“cirko”,“description”:“Pushups”,“duration”:15,“date”:“Thu Dec 01 2022”,“_id”:“63887fdd272e04ca6692e9e7”}
const date in ‘/api/users/:_id/exercises’ route:
Console log of date const in ‘/api/users/:_id/exercises’ route: 2022-12-01T10:20:26.943Z
(data saved in mongodb for exercise model)
Turns out it was a problem to run the test from my work pc, cuz it uses proxies and stuff… Passed all the tests when I ran them on my phone, thanks for all the help, this topic can be closed now.