Custom logic experiment for achievements (10/22/2015)

One of the bigger challenges we face as we work on TroopTrack is how we handle the variations between the different organizations we support. Sometimes it results in code that looks sort of like this:

if @troop.bsa_troop? OR @troop.bsa_crew?
else if @troop.ahg_troop?
else if @troop.etc....

This has been a challenge to manage over the years, so we have invented ways of dealing with these differences without turning our code into a mess. For example, earlier this year we added the capability to completely customize the way a page looks based on the type of organization you belong to without introducing code similar to the example above. This has been a huge boon for us because it means we can easily roll out unique pages that meet the needs of each organization type we support.

We are now working on adding something similar for achievements. We want to be able to apply custom logic to awards like Boy Scout Ranks, AHG Level Awards, etc. For example, we want to be able to tell you when all the required merit badges have been completed, when leadership requirements have been met, etc. And we want to do this without turning our codebase into a complicated, soupy mess. 

Yesterday I rolled out an experiment with an approach for doing this for AHG troops. All I wanted to accomplish was to display the level awards first on the user profiles. I know that doesn't sound much, but it goes a long way toward verifying the approach. Overall the experiment was a success and it paves the way for us to do much more interesting things going forward. 

That said, I did mess up two things:

1) The level awards were listed twice.
2) Requirements for badges were listed on the profile view.

Both of these problems have since been fixed. I apologize for the errors, but I am confident that the results of the experiment will lead to significant improvements in the way TroopTrack handles special logic regarding achievements.