Fixing Things 4

All posts, RSS Feed

(This is the fourth post of a series of “fixing things” posts that give some insight into the kinds of bugs and issues we encounter, and how we investigate and solve them. Previous in this series: Fixing Things 1, Fixing Things 2, and Fixing Things 3)

This week we have been hard at work fixing all kinds of small things, as well as making several larger improvements to the Pathfinder system. In this post we want to take you with us for two of the more interesting fixes we had to make, how we discovered what was wrong, and how we fixed them.

The Mysterious Hole

This issues started out with us noticing something rather strange. Some campaigns had grown mysterious holes on their front pages overnight:

Mysterious Hole

As you can see in the screenshot (with orange markings surrouding the mysterious hole) the front page that should be page-wide is not, and the space where it should be is just an empty hole without anything in it.

What made the hole so mysterious is that it just popped up overnight. We couldn’t think of a single thing we changed that could cause such a hole to suddenly appear.

Not being able to think of anything that could cause the hole, we started our investigation by looking at the site’s structure. And what we found was a step in the right direction, but did little to clarify what was going on: we found an empty box that serves as a container for announcements. But such a box ought to have announcements in it and should — as far as we knew — not be shown if there are no announcements to display.

We continued our investigation with the code that produces the front page. The lack of announcements was soon explainable: announcements are only shown to players in the campaign, and because I was not a player none of the announcements were shown to me… However if there are no announcements to be shown the announcements box should not be shown either, and it clearly was.

After carefully walking through the code we found the cause of the mysterious hole: the method we use to check if the currently logged in player is allowed to see each announcement was fine, but the way we checked if there were any announcements left to show was not.

As is often the case with issues such as these, the fix itself is absurdly simple once you know what the issue is. Five characters later the mysterious hole was no more.

The “andmoderator”

One of the system messages you can receive is one that informs you that you have been given additional roles in a campaign. The title of the messages shows these roles:

You were made engineer, game master, andmoderator

This is not a typo in the blog post – RPGpad clearly told everyone that they were made an “andmoderator” in their campaign.

We quickly traced down the issue to our Oxford comma joining function. This function should work roughly as described here:

1. If we get 1 item:
       the result is just "item".
2. If we get exactly 2 items:
       the result is "item1 and item2"
3. If we get more than 2 items:
       the result is "item1, item2, ..., and itemN"

This function helps us to make nice and readable lists of things in a textual format. For some reason, the function was smashing the “and” and the name of the third role — “moderator” in this case — together to tell people about the “andmoderator”.

Sure that the fix would be easy, we quickly adjusted the details of the function, and how the “and” part of the result was put in place. We tested our fix, and nothing changed. Clearly we made a mistake while fixing it. So we adjusted things again, taking care to make sure that we have the right spaces in all the right places. We tested our new fix, and again nothing changed.

We do not accept that the system does something we don’t want it to. We poured ourselves a new mug of tea, and started to really work the problem. We took apart the code of our function piece by piece, until we were absolutely sure that it should work. And yet, it still did not.

After this effort — and being somewhat miffed to still be dealing with the “andmoderator” — we started checking all relevant side-conditions: was one of our assumptions about how this should work wrong, did we miss a note in the documentation, maybe we misunderstood the way spaces are handled in the template?

Eventually, we discovered that our function was fine… There is a bug in the version of the templating library we use. A bug that, in this specific situation, caused the spaces to disappear. And once again, the fix was simple once we knew what the issue was. We updated the template library to the newest version, which fixes the issue.


These two smaller fixes, and many, many more fixes and improvements can be seen in the detailed list of changes available for you in this week’s changelog. And if you have any feedback, questions, or feature requests, do let us know on the community forum!