Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to save drawn track #423

Open
okvittem opened this issue Aug 18, 2018 · 4 comments
Open

Unable to save drawn track #423

okvittem opened this issue Aug 18, 2018 · 4 comments

Comments

@okvittem
Copy link

Hi,
We have a race that we can not save drawn tracks in because the save button does
not activate when the Finish control is clicked. The XML for the race is enclosed.
holonda.txt
The code for the FinishPoint is FIN1 is that unexpected ?

The race is at http://orientering.stbik.no/rg2/#317&course=2. If you want to test - choose
the Rød cource and name Olav Kvittem.

@Maprunner
Copy link
Owner

Sorry, only just got round to looking at this.

FIN1 is not a problem. The courses are read in correctly from the XML file.

I think the problem was probably the results file. Everybody seems to have a trailing 0 split. Do you have the results file so that I can have a look at that?

@okvittem
Copy link
Author

Good that you found time to look at it !
Did not find any legs with Time 0 :
result.txt

@Maprunner
Copy link
Owner

Your XML file does not comply with the IOF V3 standard. The definition of SplitTime states that:
Start and finish times must not be present as SplitTime elements.

Your file includes a split time for control 100 for everybody. I guess this is the Emit finish unit. It is not defined as a control on any of the courses (which is correct).

This means that every result has an extra split at the end for a non-existent control.

@MaBreaker
Copy link

MaBreaker commented Jan 23, 2021

Hi,

it seems that the main reason for this behavior is that RG2 result parser scripts for IFO v2 and v3 are both blindly adding "finish time" to the end of the split time array.

resultparseriofv2.js

this.extractIOFV2Splits(splitlist, result);
finishtime = this.getStartFinishTimeAsSecs(resultlist[i].getElementsByTagName('FinishTime'));
result.splits += Math.max(finishtime - result.starttime, 0);

resultparseriofv3.js

this.extractIOFV3Splits(splitlist, result);
finishtime = this.getStartFinishTimeAsSeconds(rg2.utils.extractTextContentZero(resultlist[k].getElementsByTagName('FinishTime'), 0));
if (finishtime > 0) {
    result.splits += finishtime - result.starttime;
} else {
    result.splits += 0;
}

I assume that idea behind this is that all results would have "finish time" and last finish control punch would be not listed in the result xml split times like Simon commented.

Usually weekly events are held by using free simple tools like "E-Results Lite". Also these events do not have pre-defined start times or separate Finish line. So the last split time is actually the "finish control" time. In these cases there is no "FinishTime" in results file at all or it is the same as the last split time.

With these type of events RG2 adds unwanted split time (0 or calculated FinishTime - StartTime) to the end. This is then seen on kilpailijat_xx.txt as a duplicate punch time or zero at the end. This behavior also messes up RG2 manual route dawing funtion. That is because RG2 uses split times (instead of actual controls on the course) while counting controls to be shown while user is drawing a route. Also this one additinal split time at the end, prevents "Save"-button from getting enabled at the end.

Some tools might allow "finish control" number to be left out or defined separately like Simon commented, but not all. Also IFO XML result file might be not accoring to the standards with all tools.

Anyway, we have came around this specific issue. Not by fixing RG2 "resultparseriofv2.js" or "resultparseriofv3.js" or "IOF XML result" files manually, but simply adding following lines to "result.php" PHP script. This blindly strips off all duplicate times at the end of "kilpailijat_xx.txt" results while processing rg2api calls. This also fixes all of the past RouteGadget and RG2 events without a need to edit kilpailijat_yy.txt result files manually.

You can test if this works for you or not.

result.php

// split array at ;and force to integers
$detail["splits"] = array_map('intval', explode(";", $temp));
//FIX - remove last split time if it is zero or the same as finnish time
$splits = $detail["splits"];
$split_count = count($splits);
while (($split_count > 1) && (($splits[$split_count - 1] === 0) || ($splits[$split_count - 1] === $splits[$split_count - 2]))) {
  $split_count = $split_count - 1;
}
array_splice($splits,$split_count);
$detail["splits"] = $splits;
//$detail["comments"] = "";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants