Sharing code

Trooptrack has been great since our troop has switched over to it 9/2015. There’s always a few small limitations of things that I’d like to see, but are not implemented in Trooptrack. So, I’ve been writing scripts for TroopTrack since July of last year once I got my developer partner token. I’ve asked questions here and the community has helped me get past those issues. So, I thought I’d share some of my work.

Is there a way to share code here without posting the contents of the file directly?

I’d rather not use a external service like github or google drive. I believe all the people that would want to use this script would be on TroopTrack already.

(I’ll describe the script in a reply to this message next.)

OK. The Python script I have ready to share is called UpdateMeritBadgeRanks.py. It’s free to use as-is and do whatever you want with it. This is the description of the script from inside the script:

The purpose of this script is to calculate the order of completed merit badges to apply them to each rank and then use the web portal to update each completed merit badge to assign the correct rank if needed. It will also assign the date completed in the rank when a scout finishes all the merit badges required for a rank.

So, I use both the TroopTrack API and the Web interface both from python to do this. I started out using the API only to kind of tell me which ranks should I assign to each merit badge. But then I thought I should be able to assign the merit badge directly. So, I figured out how to open the web page and assign it there. Beyond that, because the API does not show the Nickname of the troop member, I also pull the Nickname from the web as well. It might not be really needed for this script, but it’s there.

I really have been learning Python from the web over the last 1 -1.5 years. So, I’m sure there are more efficient ways to do things. And I know that my threading code could be sped up as well. But I only have so much time to tinker around and usually, when it works, I tend to leave it alone for awhile.

Anyway, I’d love for TroopTrack to see this and choose to either:

  1. Update the APIs to allow us to access more parts directly through the API (without having to fake the web connection.)
  2. Incorporate the script directly - Our last SW auto-characterized all the Merit Badges into ranks and automatically filled out the rank completion requirement when the correct number of MBs was finally earned for a rank. So, all I was doing here was the same idea.

Thanks!

Looks like there’s already a request for what my script does here:

Since I didn’t see any reply here, I’m going to try something. I’ve uploaded my python script to my profile and I’m copying that link here:
https://trooptrack-prod.s3.amazonaws.com/uploads/attachment/attachment_file/165047/UpdateMeritBadgeRanks.py
I don’t know if there’s any protection on that file that would disallow others to see it. Hopefully everyone can see it.

Again, feel free to ask questions about it, suggest improvements, or enjoy it as-is or with your own additions. If the work here is worth something and helpful to you, let me know.

Hope it helps,
Steve

FYI - Because people showed interest in my script to organize merit badges per rank, I created scripts without needing the TroopTrack API to do all of this work. If you are interested, see the post here: