How to track Spartan rank.

I cant figure out how would you track a Players Spartan rank, and how much they need to get to next rank. I know how to get a Players current spartan rank and how much XP they have, and I know I can make call to get all Spartan Ranks from the API, but how would I calculate how much XP they need to get to get to next rank from this data? I see some of the projects submitted have Spartan Rank progress, and that is what I would want. Any help appreciated.

I’am using PHP (Laravel 5) if that matters.

I’ve not done anything with Spartan Ranks but with the information you’ve already got I would assume you could do something like this:

  1. Get the player’s TotalXP and CurrentRank
  2. Get the NextRank
  3. Their Progress into the current rank is TotalXP - CurrentRank.startXp
  4. The TotalXpRequired for the current rank is NextRank.startXp - CurrentRank.startXp
  5. Percentage through current level = Progress/TotalXpRequired

There might be a better way, that’s just off the top of my head.

Ok, I will try to do the method you said. Thanks.