freeCodeCamp / freeCodeCamp

freeCodeCamp.org's open-source codebase and curriculum. Learn to code for free.
http://contribute.freecodecamp.org/intro
BSD 3-Clause "New" or "Revised" License
402.57k stars 37.31k forks source link

MSLearn C# Course - Timeline - View button - User is shown a JSON object instead of the appropriate achievement page #53073

Open steven-the-qa opened 8 months ago

steven-the-qa commented 8 months ago

Describe the bug The "View" button on the public profile Timeline leads to webpage serving a JSON object for the MS Learn C# course trophy achievements in the feed.

Example: https://learn.microsoft.com/api/gamestatus/f1787997-8b19-4837-bdeb-ad536637b5dd

To Reproduce Steps to reproduce the behavior:

  1. Complete a module on the Microsoft Learn C# course and verify the trophy on freeCodeCamp
  2. Go to the user's public profile
  3. Scroll down to the Timeline
  4. Click on the "View" button for your trophy achievement

Expected behavior 1 of these 2 options could work:

The link leads to the "Learning Paths" tab of the Achievements section of the user's Microsoft Learn public profile. Example: https://learn.microsoft.com/en-us/users/stevenboutcher-4303/achievements?tab=tab-learning-paths

OR

The link leads to the achievement's own shareable page. Example: https://learn.microsoft.com/en-us/users/stevenboutcher-4303/achievements/24uqr9cv

Screenshots fcc_bug_1 fcc_bug_2

Desktop:

naomi-lgbt commented 8 months ago

@moT01 want to take a look at this issue?

moT01 commented 8 months ago

I prefer the second option. Here's a map of the challengeId and the associated achievement ID's from Microsoft that they use in the URL's:

const msAchiviementId = {
  "647f85d407d29547b3bee1bb": "yzhut2fr", // get-started-c-sharp-part-1.trophy
  "647f87dc07d29547b3bee1bf": "uw5snbr3", // get-started-c-sharp-part-2.trophy
  "647f882207d29547b3bee1c0": "pdz7z364", // get-started-c-sharp-part-3.trophy
  "647f867a07d29547b3bee1bc": "zqffgbx2", // get-started-c-sharp-part-4.trophy
  "647f877f07d29547b3bee1be": "eb77357p", // get-started-c-sharp-part-5.trophy
  "647f86ff07d29547b3bee1bd": "hfg6yak8" // get-started-c-sharp-part-6.trophy
}

We have the campers MS username, so we can use that and the map above to generate a URL - something like this:

if (challengeId in Object.keys(msAchievementIds)) {
  const msUsername = getCampersMsUsername();
  solutionUrl = `https://learn.microsoft.com/users/${msUsername}/achievements/${msAchievementId[challengeId]}`;
}

(Untested code) What do you think @boutchersj?

Edit: I'm not actually sure how those id's that MS uses work, but they seem to work no matter what username you put in there.

steven-the-qa commented 8 months ago

I prefer the 2nd option as well. It's more useful to the user, since they can copy/paste the URL to share it anywhere, and it's specific to that 1 achievement.

moT01 commented 7 months ago

There's some more discussion on this in the PR above that was closed. This may be a little trickier than it should be. I will take a closer look when I get a chance.