bdgio / msol-site

Mozilla Public License 2.0
0 stars 2 forks source link

In MSOL Admin if a new badge is added with a name that is equivalent to an existing badge the badge is added but reverts to the existing badge page #107

Open threeqube opened 9 years ago

threeqube commented 9 years ago

@kayaelle speculates this has to do with the short code name of the badge that also becomes the human readable url.

From @kayaelle: "Not open badger at all. It's the short code name. Maybe the there need to be issuer + short code name or we add a new field for URL that can default to short code but be modified in the admin. I vote for the latter."

threeqube commented 9 years ago

I think there will be more badges with same names coming down the pike so we should definitely figure out a solution for this. Today, adding a badge from a new org with an existing badge name. Will do what I did for the programming for beginner's badge. https://www.mainestateoflearning.org/admin/badge/programming-for-beginners-spl

kayaelle commented 9 years ago

All links to badges now include issuer name. For example: /breakwater-enrichment-program-b-aerial-dance-basic-choregraphy

findBadgeByShortName function removes everything before and including "-b-".

This is on stage.

threeqube commented 9 years ago

Hmmm...not sure if this is on stage yet. Just tried creating an "Intro to Chemistry" badge on stage which already exists under Breakwater Learning and after creating the new "Intro to Chemistry" badge, it went to the Breakwater "Intro to Chemistry" badge.

threeqube commented 9 years ago

Actually I do think it's on stage. Don't think it's working quite yet though. Still seeing the issue.

kayaelle commented 9 years ago

It appears that all of the badge functionality in open badger is based on the badges having a unique name. Everything (or everything I've seen so far) is based on short-name lookup, so even though the urls have issuer name, when the badge gets looked up, it will find the first instance of that name. That's no good. It should really use a unique id or a unique badge name. 3 options I can think of: 1) Don't use duplicate badge names (What happened when you did use the same badge name initially?) 2) Change all the code to use the badge _id - not sure what the implications are of this throughout the code. Could be fairly time consuming 3) Ensure that all badges when created (as well as all existing badges) have a unique short name - probably something like: portland-trails-badge-name.

1 & 3 are probably the best options. Option 1 because I can revert the url code quickly and add code that checks for the name before saving and give an error message if it's a duplicate name. Option 3 because it will allow you to have duplicate names. I'd have to write a script to change all the short-names for all the badges but it'd still be less time than option 2 (which is probably how you want to do it in the future).

threeqube commented 9 years ago

Leaning towards option 3.