Build an fCC Forum Leaderboard - Help for Future learners

I completed this exercise. But the current status of this exercise’s forum makes it clear that it was recently converted from a “Workshop” where we’re guided step-by-step to a “Lab” where we’re meant to write our own code. The transition wasn’t smooth. I have two “helpful hints” for future people attempting it:

First, steps 8-12, concerning the avatars function, need a major rewrite, particularly step 9. In step 9, you’re meant to iterate over the posters array and pull the needed data from the corresponding entry in the users array. That could be made clearer. The learner should also be made aware of the structure of those arrays.

Second, until the instructions are updated to tell us this structure, I’ve pulled this from the test page on GitHub: It’s the actual data that your avatars function will be tested against. Hopefully you can figure out the structure from this.

const posters = [{ user_id: 6 }, { user_id: 285941 }, { user_id: 170865 }];
const users = [
  {
    avatar_template:
      '/user_avatar/forum.freecodecamp.org/quincylarson/{size}/212400_2.png',
    id: 6,
    name: 'Quincy Larson',
    username: 'QuincyLarson'
  },
  {
    avatar_template:
      '/user_avatar/forum.freecodecamp.org/jwilkins.oboe/{size}/179497_2.png',
    id: 285941,
    name: 'Jessica Wilkins',
    username: 'jwilkins.oboe'
  },
  {
    avatar_template:
      '/user_avatar/forum.freecodecamp.org/ilenia/{size}/270648_2.png',
    id: 170865,
    name: 'Ilenia',
    username: 'ilenia'
  },
  { id: 20 }
];

(Since I know @ILM is going to suggest it anyway: I’m in the process of writing this up as an issue on Github.)

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:139.0) Gecko/20100101 Firefox/139.0

Challenge Information:

Build an fCC Forum Leaderboard - Build an fCC Forum Leaderboard

1 Like

Hi there!

Test #27 says you should fetch data from https://cdn.freecodecamp.org/curriculum/forum-latest/latest.json. Learners can console.log() the data returned to see the structure, right?

Happy coding!

Short answer: Yes. Longer answer: That data is much more extensive, and the instructions for that portion of the exercise are a lot better. The only way I was able to figure out the section about the avatars function was by referring to the tests on GitHub.

Now, maybe this is meant to demonstrate something else: Maybe in a real-world situation, badly-explained API’s are so common that this exercise is meant to lead us down this path of detective work. It’s a good lesson, but maybe this isn’t the best place iin the course to learn it.

Plus, I didn’t think of your idea when I was doing the exercise myself.

Thank you for opening the issue

1 Like

I found the wording of User Story #9 extremely difficult to understand. I’ve added a suggestion to your Issue.

Looking at the structure of the data returned by the API should almost be a given, you can just throw the url into the browser and navigate the JSON data.

1 Like