LukeWoodward / SplitsBrowser

Orienteering results analysis
GNU General Public License v2.0
13 stars 9 forks source link

Splitsbrowser not opening #56

Closed MrHelga closed 6 years ago

MrHelga commented 6 years ago

Since a couple of months, I'm using the XML v3 format for Splitsbrowser. It's been working fine, but yesterday a competition in Brazil published the results, but the Splitsbrowser page is not showing anything. The XML is valid. Could you please check? https://helga-o.com/webres/splits/splitsbrowser.php?lauf=2289 The XML: https://helga-o.com/webres/splits/readsplits.php?lauf=2289

Many thanks!

mikaello commented 6 years ago

I checked your XML-data against the IOF XSD, and I also found it to be valid.

If you check the console of https://helga-o.com/webres/splits/splitsbrowser.php?lauf=2289 you'll see this error message:

a {
  message: "cumulative times array does not start with a zero cumulative time",
  name: "InvalidData"
}

This error is thrown in data-repair.js when the first element of cumulative times is not zero.

When you for example look at the first personresult-element in your XML file it looks like this:

    <PersonResult>
      <EntryId>7669</EntryId>
      <Person sex="M">
        <Name>
          <Family> </Family>
          <Given>H21E NAME REMOVED</Given>
        </Name>
      </Person>
      <Organisation>
        <Name>Casa dos Subtenentes e Sargentos de Santo Ângelo</Name>
        <ShortName>CASUSA</ShortName>
      </Organisation>
      <Result>
        <StartTime>2018-04-20T19:53:00Z</StartTime>
        <FinishTime>2018-04-20T20:06:06Z</FinishTime>
        <Time>786</Time>
        <TimeBehind>0</TimeBehind>
        <Position>1</Position>
        <Status>OK</Status>
        <SplitTime>
          <ControlCode>32</ControlCode>
          <Time>24</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>78</ControlCode>
          <Time>103</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>34</ControlCode>
          <Time>163</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>52</ControlCode>
          <Time>207</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>35</ControlCode>
          <Time>287</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>37</ControlCode>
          <Time>320</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>31</ControlCode>
          <Time>355</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>40</ControlCode>
          <Time>410</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>41</ControlCode>
          <Time>466</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>42</ControlCode>
          <Time>529</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>43</ControlCode>
          <Time>560</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>44</ControlCode>
          <Time>577</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>45</ControlCode>
          <Time>606</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>46</ControlCode>
          <Time>659</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>47</ControlCode>
          <Time>694</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>56</ControlCode>
          <Time>742</Time>
        </SplitTime>
        <SplitTime>
          <ControlCode>100</ControlCode>
          <Time>777</Time>
        </SplitTime>
        <ControlCard>1009025</ControlCard>
      </Result>
    </PersonResult>

If I understand the error message correctly it expects the first split time to be equal 0, the first split in this result is

        <SplitTime>
          <ControlCode>32</ControlCode>
          <Time>24</Time>
        </SplitTime>

But that seems correct when looking at examples from IOF and example from the testdata in this repo as well, where all of them have the first split with non-zero time.

I guess @LukeWoodward can explain...

LukeWoodward commented 6 years ago

Thanks for reporting this. This appears to be an internal error regarding the split times of a couple of competitors, Robson Figueira Rengifo and João Vitor Dos Anjos Moura. Both competitors are showing a lot of missing and additional controls. If you take these two competitors out of your results, the file then loads. However, SplitsBrowser should be able to load this file. I'll look into fixing this.

The error about the first cumulative time not being zero is an internal thing. Internally, SplitsBrowser requires the list of cumulative times for each competitor to begin with zero. It signifies that at the start the competitor has been running for 0 seconds since they started. This is obvious, but it comes in useful when drawing graphs as we don't then have to treat the start as a special case. None of the data formats include this zero cumulative time, as there's not a lot of point in including it.

MrHelga commented 6 years ago

Many thanks Luke and mikaello for the explanations. Never ending improvements 😃

LukeWoodward commented 6 years ago

This turned out to be something of a corner-case bug that has probably been in SplitsBrowser for years without being hit, or without being reported to me at least.

In order to trigger this bug, you need to have a competitor whose first few cumulative times are either zero or missing, and at least two runs of missing times between zero times. (The initial zero cumulative time at the start can count as one of the zeroes here.) Both competitors previously mentioned have cumulative times like this.

Fortunately this is straightforward to fix. Version 3.4.2 of SplitsBrowser (which I have now released) includes this fix and should now load the data file that 3.4.1 fails to.

MrHelga commented 6 years ago

Cool... unfortunately it does not show up in https://github.com/LukeWoodward/SplitsBrowser/releases yet?

LukeWoodward commented 6 years ago

Sorry, I missed a step when doing the release. That should be done now.

It's been a while since I did the last release....