Hi Jon,
After digging java and html references most of the night I was able to make a script that modifies the nett points and reorders the ranks.
I still have one problem. I would like to score in two divisions (based on rating), but still get the points of individual races like all sailed in one division. Now the parameters s and p in the point formula change when scoring in two division vs. in one group. The races have different rating divisions, thus SI for the series gives points based on position and participants in each race’s each division, not based on division for the series.
I could dig up the number of partisipants and places from the individual race results in java, but that seems like a quite a lot of work.
So is there a way to do this part before the Effect is called? One way of doing it seems to be adding line ““scrfield”,“Division”,“104”,”"" to the blw after rescoring in one group and then open that and publish it without rescoring, but that seems quite error prone approach.
Below is the java I added to ScoredSeparatelyMatrix.js. It’s not pretty, but seems to get what I want and may help someone else.
Best Regards,
Joakim
var list = document.getElementsByClassName("summarytable");
var listl=list.length;
var sailed=[], races=[];
var N=0;
for(i=0;i<listl;i++)
{
var nett=-1;
var rowl=list[i].rows.length;
var celll=list[i].rows[0].cells.length;
var swap;
for(k=1;k<rowl;k++)
{
var sum=0;
var partip=0;
for(j=0;j<celll;j++)
{
if(list[i].rows[0].cells[j].innerHTML.search("race")!=-1)
{
var str=list[i].rows[k].cells[j].innerHTML;
if(str.search(" ")!=-1)
str=str.slice(0,str.search(" "));
if(str.search("[(]")!=-1) //Discarded
{
if(str.search("[)]")==-1)
str=str.slice(str.search("[(]")+1);
else
str=str.slice(str.search("[(]")+1,str.search("[)]")-1);
if(Number(str)>2.0)
str="2.0";
}
if(Number(str)>=1.0)
{
var racename=list[i].rows[0].cells[j].innerHTML;
racename=racename.slice(racename.search("[>]")+1);
racename=racename.slice(0,racename.search("[<]"));
for(n=0;n<N && races[n]!=racename;n++);
if(n==N)
{
N++;
races[n]=racename;
sailed[n]=0;
}
partip++;
sailed[n]++;
}
sum+=Number(str);
}
else
if(list[i].rows[0].cells[j].innerHTML.search("Nett")!=-1)
nett=j;
}
if(nett!=-1)
{
list[i].rows[k].cells[nett].innerHTML = (sum).toFixed(1);
list[i].rows[k].cells[nett].partip = partip;
list[i].rows[k].cells[2].innerHTML = list[i].rows[k].cells[nett].partip;
for(k1=k;k1>1;k1--)
{
var n1=Number(list[i].rows[k1-1].cells[nett].innerHTML);
var n2=Number(list[i].rows[k1].cells[nett].innerHTML);
var p1=Number(list[i].rows[k1-1].cells[nett].partip);
var p2=Number(list[i].rows[k1].cells[nett].partip);
console.log(i,k,k1,n1,n2,p1,p2);
if(n1<n2 || (n1==n2 && p1<p2))
{
console.log("swap");
for(j=0;j<celll;j++)
{
if(list[i].rows[0].cells[j].innerHTML.search("Rank")==-1)
{
swap=list[i].rows[k1-1].cells[j].innerHTML;
list[i].rows[k1-1].cells[j].innerHTML=list[i].rows[k1].cells[j].innerHTML;
list[i].rows[k1].cells[j].innerHTML=swap;
}
}
list[i].rows[k1].cells[nett].partip=p1;
list[i].rows[k1-1].cells[nett].partip=p2;
}
}
}
}
for(j=0;j<celll;j++)
if(list[i].rows[0].cells[j].innerHTML.search("Rank")!=-1)
for(k=1;k<rowl;k++)
list[i].rows[k].cells[j].innerHTML=k;
}
for(n=0;n<N;n++)
console.log(races[n], n, sailed[n]);
Hi Jon,
I’m trying to make the effect to modify the published output, but I have really hard time to get started. I have no idea how to get and set the variables needed. I have tried to follow what the expample scripts do, but I had no success.
I haven’t done any java/CSS/XML before, but I do have a lot of experience in writing C, shell scripts and awk scripts. I could easily write an awk script to modify the blw file as I wanted, but I don’t think that’s a good way of handling this, since I’m making a tool for someone else and he wouldn’t be able to use it like that.
Could you give me an example to get me started? Maybe just a script that adds 1 to each nett point.
Best Regards,
Joakim
I see Huw has just posted an answer on this while I’ve been deciding what to post.
Huw’s suggestion is along the correct lines although as it currently stands I don’t think it will do what you want as this runs and updates for every race. You would want it to run once at the end of the scoring. I did actually attempt to implement this in an earlier version but it broke the NHC code when scoring multiple fleets so I took it back out of the current version as no one was using it anyway. The principle is good as it would allow you to automate what you want.
The Set and seed tools do not allow expressions
As for the effects - although none of the demo ones modify the rank or nett points, there is no reason why a javascript effect could not modify them.
Jon
Jon Eskdale
07530 112233
Skype “eskdale”
···
On Monday, February 15, 2016 8:11 PM, “jmaja100@yahoo.com [sailwave]” sailwave@yahoogroups.com wrote:
On Monday, February 15, 2016 3:18 PM, “Jon Eskdale jon@sailwave.com [sailwave]” sailwave@yahoogroups.com wrote:
On 15 February 2016 at 12:28, jmaja100@yahoo.com [sailwave] sailwave@yahoogroups.com wrote:
Hi Jon,
I don’t want to do anything by hand, since there are 200 boats and 40 races and results are published after each race. And it would be nice to have the real results in Sailwave, not just in the published html.
How can you use tools to change the ranks and nett points? I looked at “set competitor field”, which allows to modify each field for each boat. But how is it used? Which variables are available? Can expressions be used?
The problem with these modifications is that you need to redo them after each rescore (when adding a race result to series). I really would like to automate that. I looked at some of the javascript files, but couldn’t find any manipulation of the Nett points or Ranks. I quess all that is done in the executables? And to do them for publishing you need to add an Effect?
Best Regards,
Joakim
On Monday, February 15, 2016 1:32 PM, “Jon Eskdale jon@sailwave.com [sailwave]” sailwave@yahoogroups.com wrote:
Hi Joakim,
You don’t need to edit the blw by hand to modify the Nett Points or Rank you can do this within Sailwave just select the cell and press enter or F2 (or right click and edit). You can then manually change anything and these values will get published until the next time you score or rescore the series.
You can also manipulate them with the tools from the tools menu. Quite often its useful if you have a Gold and Silver fleet which you want the Silver fleet to have rankings greater than the Gold fleet. So you could use the tools to add a fixed amount to the rank of everyone in the Silver fleet.
Jon
Jon Eskdale
07530 112233
Skype “eskdale”
On 15 February 2016 at 09:15, jmaja100@yahoo.com [sailwave] sailwave@yahoogroups.com wrote:
I’m able to edit the blw file (by hand or with a script) and make the modifications needed to Nett points and Ranks, but that is quite inconvenient.Is it possible to get “inside” the scoring routine to make the changes happen already while pressing Rescore?
Best Regards,
Joakim
On Saturday, February 13, 2016 5:19 PM, “jmaja100@yahoo.com [sailwave]” sailwave@yahoogroups.com wrote:
Yes, it’s a high point system and yes I want to add to Nett points from discards. I already did the following scoring formula for individual races. It seems to work as the table in the SI (the winner gets 3.5-12.5 points, the last.3 or 2 points depending on the number of boats).
2 + lte(p,10)*(lt(s,11)*s+gte(s,11)*10-p+1) + lt(p,2)*0.5
I also made DNF/OCS/DSQ etc. as one point and DNS/DNC as zero point.
But I haven’t been able to add the the discarded races as 1 or 2 points to Nett.
I got an idea how to solve the series ties according to the SI. Add 0.001 points to each race score (and also to the discarded ones), thus a boat with 3 races would get 7.003 and one with two 7.002. You need to use 3 decimals to get the difference. Is it possible to publish the results with just one decimal and still get the order with three? Or maybe we can just say the last two decimals are the number of races sailed.
Best Regards,
Joakim
On Saturday, February 13, 2016 1:35 AM, “Jon Eskdale jon@sailwave.com [sailwave]” sailwave@yahoogroups.com wrote:
Hi Joakim,
So you say you want to add one point for DNF/OCS/DSQ and 2 points for any finishing position so are you using a high point scoring system?
I can’t think of a way of tie breaking with the boat with most races wins.
As for expressions there is some documentation at http://www.sailwave.com/expression
As for these:-
eq = equals
ne = not equal
gt = Greater than
lt = Less than
gte = Greater than or equal to
lte = Less than or equal to
These have two parameters e.g.
eq(a,b) if a = b
gte(a,b) if a >= b
If the expression is true it returns 1 otherwise it returns 0
Jon
Jon Eskdale
07530 112233
Skype “eskdale”
On 12 February 2016 at 22:09, jmaja100@yahoo.com [sailwave] sailwave@yahoogroups.com wrote:
Hi,
I’m trying to use Sailwave for calculating a series including a large number of races (40 or so) during the season for 200+ boats. The SI for the series says that only the six best races are included, but you get activity points from the discarded races. Thus I set discard as “s-6” to get only the six best scores. How do I add one (DNF/OCS/DSQ) or two (any finished postion) activity point for each discarded race to the Nett points?
Also there’s a special rule for series ties. The boat with more races wins a tie. How to do that?
I needed to make a special formula for the point system and I got some help that releaved you can use conditional statements like lte(), gte() etc. I didn’t find any documentation about those. Is it available somewhere?
Best Regards,
Joakim