Jump to content

Small Bug In Leaderboard.xsl


jump_ace

Recommended Posts

Hey guys,

 

I've kind of taken over a project from a friend.  It's a leaderboard for posting splits for drivers.  The splits get posted to a leaderboard.xsl (which is working fine).  The update.php page is designed to update a leaderboard.xml file, this way anyone can login and update new splits for each weeks race.  (more info can be found here if you are curious).

 

I found a small bug in the leaderboard.xsl file.  It is meant for displaying the drivers splits, calculating the difference between drivers, what division they are, car they used and includes a 'Controller' column.  This is where the bug is. 

 

Normally, it will display if that driver uses a gamepad or a steering wheel.  If it's a one lap aka 'hotlap' race, the Controller column shows either a 'wheel' or 'controller' as it should.

 

However, if it's a multi-lap race (2+ laps), then the Controller column automatically defaults to the <xsl:otherwise> option of a "?".

 

Here is an example of the Controller column working properly for each driver:

 

frsleaderboard.jpg

 

Here is what it does when there are two (or more) sets of splits for each driver on the leaderboard:

 

frsleaderboardbug.jpg

 

The code makes the post over the character length, you can view the code here.

 

Any assistance/help would be great appreciated as I'll be done with the project then :D

 

 

Jerome

 

Link to comment
Share on other sites

OK, so can you give a little more information. Is the value being saved incorrectly or is it a problem when the values are displayed?

 

It's being saved properly in the leaderboard.xml file, likely a problem when the values are displayed; gives "?" instead.

 

EDIT:

 

A shot in the dark:

					<!-- Controller -->
				<xsl:if test="../descendant::driver/@controller">
				<td class="controller" rowspan="{count(lap) + 1}">
					<xsl:choose>
						<xsl:when test="@controller = 1">
							<xsl:text>Wheel</xsl:text>
						</xsl:when>
						<xsl:when test="@controller = 2">
							<xsl:text>Gamepad</xsl:text>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text>?</xsl:text>
						</xsl:otherwise>
					</xsl:choose>
				</td>
				</xsl:if>

 

That worked!  Now single lap and multilaps show the controller!  YES!  Thank you so much  8)

 

Jerome

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.