Scoreboard Standings Data Fields - pc2ccs/pc2v9 GitHub Wiki

Overview

As described at Scoreboard HTML Configuration, the HTML scoreboard pages generated by PC² are created as a result of the presence of .xsl files in the data/xsl directory. These .xsl files can contain references to a variety of data fields contained in the XML standings data created by the PC² scoring algorithm which the XSL Transformation process can then use to update the generated HTML pages.

The XML standings data is organized as a hierarchical collection of XML elements. The top level element is named contestStandings, and contains two types of child elements:

  • A single instance of a child element named standingsHeader.
  • One child element, named teamStanding, for each team in the contest (or more correctly, for each team with the property displayOnScoreboard).

The contents of the standingsHeader and teamStanding elements are described in detail below.

Each element or attribute in the XML standings document can be referenced in an XSL document by using the XSL @ field selector notation (see Examples, below).

Developer's Note: the XML standings document returned by the DefaultScoringAlgorithm.getStandings() method (which is what gets processed by PC² scoreboard XSL code) can also be converted directly into a separate Java Standings class; see the PC² Standings class for further details.

StandingsHeader

The standingsHeader element contains the attributes listed in the following table. Each of these attributes can be referenced in an XSL document using the appropriate fully-qualified name (for example, the contest title can be referenced using /contestStandings/standingsHeader/@title).

title The contest title
systemName The formal name of the PC² system
systemVersion The PC² version number
systemURL The URL for PC²
currentDate The date and time at which the standings were generated
generatorId The tool version which was used to generate the standings
scoreboardMessage The scoreboard status message associated with the standings (e.g. whether the standings are for a "Live" (private) or "Frozen" (public) scoreboard
problemCount The number of contest problems (does not include "hidden" problems)
siteCount The number of PC² sites in the contest
groupCount The number of groups defined in the contest
medianProblemsSolved The median number of problems solved by all teams
totalAttempts The total number of submissions, by all teams on all problems, in the contest
totalSolved The total number of correct submissions, by all teams on all problems in the contest
problemsAttempted The number of different contest problems for which at least one submission has been received

In addition to the above-listed attributes, the standingsHeader element contains three types of child elements:

  • A single groupList element which in turn contains one group child element for each group defined in the contest.
  • A single colorList element which in turn contains one colors element for each set of balloon colors defined for a site in the contest.
  • One problem element for each problem defined in the contest.

Each of these standingsHeader child element types is described below.

GroupList

The groupList element contains zero or more child elements, each of which is named group. Each group element beneath the groupList describes a single scoring group in the contest and contains the following fields:

id The id of the group
title The title of the group
externalId The "external ID" (e.g. from the ICPC Contest Management System) associated with the group
pc2Site The PC² site with which the group is associated

ColorList

The colorList element contains zero or more child elements, each of which is named colors. Each colors element describes the balloon colors which a particular contest site associates with each of the contest problems. A colors element contains the following attributes:

id A unique ID for this set of site balloon colors
siteNum The PC² site which with this set of balloon colors is associated

Each 'colors' element also contains one child element, named problem, for each contest problem. Each problem element contains the following attributes giving the balloon color information for that problem for that site:

id The ID of the problem which this balloon color at this site is associated with
color A string containing the "name" of the balloon color for this problem at this site (e.g., "Blue")

Problems

The standingsHeader element contains one child node, named problem, for each problem defined in the contest (however, only problems not marked as "hidden" by the Contest Administrator are present). Note: do not confuse this problem element (in the standingsHeader) with the problem element in the colors element(s) within the colorList. The latter defines, for each problem in the contest, the balloon color which a particular site associates with that problem; the standingsHeader problem element contains standings information regarding each problem.

Each problem element under the standingsHeader contains the following fields:

id The ID of the problem
title The text title of the problem
attempts The total number of attempts made on this problem by all teams
numberSolved The total number of teams who have solved this problem
bestSolutionTime The time of first solution of this problem (present only if the problem has been solved)
lastSolutionTime The time of the most recent solution of this problem (present only if the problem has been solved)

TeamStandings

The top-level contestStandings element contains one teamStanding child element for each team in the contest (or more correctly, for each team with the property displayOnScoreboard). Each teamStanding element gives standings information for one particular team. A teamStanding element contains the following attributes:

teamId The team number (login account number); for example, the teamId for Team 5 at Site 2 is "5" (note that team numbers are site specific; there can exist a "Team 5" at multiple sites)
teamName The display name for this team
firstSolved The the id of the first problem solved by this team (or -1 if the team has not solved any problems)
lastSolved The id of the last (most recent) problem solved by this team (or zero if the team has not solved any problems)
points The penalty points accrued by this team for solved problems
solved The total number of problems solved by this team
rank The current standings rank of this team (starting at 1)
index The (zero-based) index of this team in the standings (could be different from rank, due to ties)
teamSiteId The PC² site number for this team
teamKey A key which uniquely identifies this team contest-wide; for example, the teamKey for Team 5 at Site 2 is "2Team5"
teamExernalId The external id associated with this team
shortSchoolName The shortened form of the name of this team's
teamAlias The alias for this team (if any)
groupRank The ranking of this team within its group (only present if the team has been assigned to a group)
teamGroupName The name of the group which this team is in (only present if the team has been assigned to a group)
teamGroupId The group ID for the group which this team is in (only present if the team has been assigned to a group)
teamGroupExternalId The external ID for the group which this team is in (only present if the team has been assigned to a group)
scoringAdjustment An integer scoring adjustment which is applied to this team's score (normally zero)
totalAttempts The total number of submissions which this team has made on all problems
problemsAttempted The total number of different problems for which this team has submitted an attempted solution

Each teamStanding node also contains one child element for each contest problem, each of which is named problemSummaryInfo and gives information about this team's performance with regard to one specific contest problem. Each problemSummaryInfo child element contains the following attributes:

index The index number of the problem in the contest
problemId The ID of a problem
attempts The number of attempts (submissions) this team has made on this problem
points The number of penalty points accrued on this problem by this team
solutionTime The time at which this team solved this problem (if solved)
isSolved A boolean indicating whether or not this problem has been solved by this team
isPending A boolean indicating whether or not this team has a pending submission for this problem

JSON Equivalency

Certain portions of the PC² system -- for example, the Web Team Interface project (see Web Team Interface Implementation) -- convert the XML standings data into JSON format. Here is an example of what the contest standings look like in JSON form:

{
  "contestStandings": {
    "teamStanding": [
      {"teamName": "team1", "teamExternalId": 1001, "teamGroupExternalId": 123, "teamGroupName": "Group A",
        "scoringAdjustment": 0, "teamGroupId": 1, "totalAttempts": 1, "index": 0, "solved": 1, "problemsAttempted": 1,
        "lastSolved": 1, "points": 1, "teamAlias": "team1 (not aliasesd)", "groupRank": 1,
        "problemSummaryInfo": [
          { "isSolved": true, "index": 1, "solutionTime": 1, "isPending": false, "problemId": "hello--8110896382394667630",
            "attempts": 1, "points": 1 },
          { "isSolved": false, "index": 2, "solutionTime": 0, "isPending": false, "problemId": "sumit-4446875148784840447",
            "attempts": 0, "points": 0 }
        ],
        "firstSolved": 1, "shortSchoolName": "", "teamId": 1, "teamKey": "1TEAM1", "rank": 1, "teamSiteId": 1 
      },
      {"teamName": "team2", "teamExternalId": 1002, "teamGroupExternalId": 456, "teamGroupName": "Group B",
        "scoringAdjustment": 0, "teamGroupId": 2, "totalAttempts": 1, "index": 1, "solved": 0, "problemsAttempted": 1,
        "lastSolved": 0, "points": 0, "teamAlias": "team2 (not aliasesd)","groupRank": 1,
        "problemSummaryInfo": [
          { "isSolved": false,  "index": 1, "solutionTime": 0, "isPending": false, "problemId": "hello--8110896382394667630",
            "attempts": 0, "points": 0
          },
          { "isSolved": false, "index": 2, "solutionTime": -1, "isPending": false, "problemId": "sumit-4446875148784840447",
            "attempts": 1, "points": 0
          }
        ],
        "firstSolved": -1, "shortSchoolName": "", "teamId": 2, "teamKey": "1TEAM2", "rank": 2, "teamSiteId": 1
      },
      {... additional "teamStanding" elements here ...}
    ],
    "standingsHeader": {
      "siteCount": 1, "problemCount": 2, "totalAttempts": 2, "currentDate": "Tue Jun 16 13:55:05 PDT 2020",
      "medianProblemsSolved": 0, 
       "groupList": {
          "group": [ {"externalId":123,"id":1,"title":"Group A"}, {"externalId":456,"id":2,"title":"Group B"} ]
       },
      "problemsAttempted": 2, "systemURL": "http://pc2.ecs.csus.edu/", "title": "Sumit Hello Sample V2", "systemVersion": "9.7",
      "colorList": {
        "colors": {
          "problem": [ { "color": "red", "id": 1 }, { "color": "yellow", "id": 2 } ], "siteNum": 1, "id": 1
        },
        {... "colors" elements for additional sites (if any) here...}
      },
      "generatorId": "$Id$", "scoreboardMessage": "Scoreboard is frozen",
      "problem": [
        { "lastSolutionTime": 1, "bestSolutionTime": 1, "id": 1, "title": "Hello", "numberSolved": 1, "attempts": 1 },
        { "id": 2, "title": "Sumit", "numberSolved": 0, "attempts": 1 }
      ],
      "groupCount": 3, "systemName": "CSUS Programming Contest Control System", "totalSolved": 1
    }
  }
}

Example Usages

  • The following XSL statement could be used to display the Contest Title in <h2> font in an HTML document:
<h2><xsl:value-of select="/contestStandings/standingsHeader/@title"/></h2>
  • The following XSL will display the "scoreboard message" (indicating for example whether this scoreboard is "Live" (showing actual current standings) or "Public" (showing standings which apply a scoreboard freeze):
<xsl:value-of select="/contestStandings/standingsHeader/@scoreboardMessage"/>
  • The following XSL will loop through all the groups defined in the contest, putting onto the current HTML page a link to a separate page for each such group (note that this does not create the separate groupX.html pages; it simply puts a link to such pages on the current HTML page):
<xsl:for-each select="/contestStandings/standingsHeader/groupList/group">
  <xsl:call-template name="groupLink">
    <xsl:with-param name="group" select="@id"/>
  </xsl:call-template>
</xsl:for-each>
...
<xsl:template name="groupLink">
  <xsl:param name="group"/>
  <xsl:for-each select="/contestStandings/standingsHeader/groupList/group[@id = $group]">
      <a href="group{$group}.html"><xsl:value-of select="@title"/> Per Site Standings </a> <br/>
  </xsl:for-each>
</xsl:template>
  • The following XSL will loop through the standings for all teams and insert each team's rank, name, number of problems solved, and penalty points into adjacent cells in consecutive rows of a table:
<table>
  <xsl:call-template name="teamStanding"/>
</table>
...
<xsl:template name="teamStanding">
  <xsl:for-each select="/contestStandings/teamStanding">
    <tr><td><xsl:value-of select="@rank"/></td>
        <td><xsl:value-of select="@teamName"/></td>
        <td><xsl:value-of select="@solved"/></td>
        <td><xsl:value-of select="@points"/></td>
    </tr>
  </xsl:for-each>
</xsl:template>

See Also

⚠️ **GitHub.com Fallback** ⚠️