Back End Development and APIs Projects - Exercise Tracker

Tell us what’s happening:
I got 1 last error from the 4th Project in Back End Development & APIs. It is:

You can add from, to and limit parameters to a GET /api/users/:_id/logs 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.

I’m sure that the ‘from’ ‘to’ and ‘limit’ is working, but the test still failing. Could there be anything wrong with it?

Your project link(s)

solution: b-end-fcc-exercise-tracker - Replit

githubLink: GitHub - ricky-kiva/be-fcc-exercise-tracker: Make exercise tracker app for FCC project

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0

Challenge: Back End Development and APIs Projects - Exercise Tracker

Link to the challenge:

When I’m trying it myself WITHOUT the from, to, or limit then I get an error/404. All 3 filters should be optional.

Here’s the link that doesn’t work: https://replit.com/@ricky-kiva/b-end-fcc-exercise-tracker/api/users/637a545958f563831e0fc83b/logs

Already resolved. It’s because the limit query parameter doesn’t work quiet well. Here is the comparison between the old & new program behind limit functionality:

NEW:

            for (let i = 0; i < arrLog.length; i++) {
              logDate = Date.parse(arrLog[i]['date'])
              if (logDate >= logFrom && logDate <= logTo) {
                arrLogFilter.push(arrLog[i]);
              }
              if (logLim && logLim == (arrLogFilter.length)) {
                break;
              }
            }

OLD:

            for (let i = 0; i < arrLog.length; i++) {
              logDate = Date.parse(arrLog[i]['date'])
              if (logDate >= logFrom && logDate <= logTo) {
                arrLogFilter.push(arrLog[i]);
              }
              if (logLim && logLim == i + 1) {
                break;
              }
            }

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