Open Badge Generator & Issuer Updates!

Well, I spent last week tinkering with the Open Badges Generator that I worked on. I managed to implement a couple of features that I was keen to get in, specifically referencing each issued badge with a unique ID rather than a row number.



I had a little scout around stackoverflow and found a nice little chunk of code by 'thoughcrime' which generated an 8 character random string. This would create me my uniqueID I was after. Here's the snippet:

function genRandomString(len, bits){
  bits = bits || 36;
  var outStr = "", newStr;
  while (outStr.length < len)
  {
    newStr = Math.random().toString(bits).slice(2);
    outStr += newStr.slice(0, Math.min(newStr.length, (len - outStr.length)));
  }
  return outStr.toUpperCase();
}

I did have to change the whole flow to accompany this new addition though, so the auto-email that was sent with the dynamically generated URL had to be amended, the querystring capture in the doGet() function had to change and an additional function put in place to iterate through the rows to find the row corresponding to the uniqueID.

All in all this feature works well, it now means that I can delete specific rows and sort badges without the fear of shuffling row numbers and issuing erroneous badges.

Another feature was the addition of an expiry date, this wasn't so much of a task as it was simply adding a new form item then making sure there was a place in the badge assertion structure. A couple of error traps in place and that worked fine as well.

The above has been bundled into the latest release which can be found here:

https://gist.github.com/thedavidmullett/54a5153f6298539ce05d




Comments

Popular posts from this blog

Positive feedback on Elevate's student inductions

Mahara Upgrade Complete - How did it go?

Threshold Concepts, Jared and Aperture Science Laboratories.