mozilla / openbadges-badgekit

No Longer Maintained
https://badgekit.org
Mozilla Public License 2.0
123 stars 84 forks source link

Badge criteria pages are broken #468

Closed cmcavoy closed 9 years ago

cmcavoy commented 9 years ago

The criteria page url that's being sent in the emails is something like,

https://badgekit.org/system/openbadges-badges/badge/badge-alliance-working-group-contributor/criteria

That 404's. It's because the badge slug isn't right. We switched to ugly slugs at some point, so this works:

https://badgekit.org/system/openbadges-badges/badge/ab589dc50aeb72ac0ef1e49ac817d3c3/criteria

The issue is either the stored criteria url, the criteria url being passed to the front end for emailing, or the criteria url that the email service is assembling.

cmcavoy commented 9 years ago

Looks like the issue is here, https://github.com/mozilla/badgekit-api/blob/c4f9fb0d423b9ae000998cb0b1cf41186cc3c7ee/app/routes/badges.js#L335

The api is taking the criteria url that the client (badgekit) is sending to it, but they're not agreeing on slug names anymore.

cmcavoy commented 9 years ago

Maybe the easiest solution is to create a getBadgeByCriteriaUrl endpoint on the API?

cmcavoy commented 9 years ago

hey @christensenep if you could review my pr, that would be helpful. However, pushing to prod because of timing issues.

cmcavoy commented 9 years ago

The issue is badgekit and badgekit-api don't agree on slugs anymore. api is creating a slug and returning it to badgekit, but badgekit isn't storing it.

Solution for now was to not call out to the api when we build the criteria page. Just let it build the page from data in the badgekit db. Not perfect, but it works. To get the right badge, had to do a hack where we iterate over all the possible badges. It's not great.

Ultimately, would like to add an end point to api that let's you look up a badge by criteria url.