Hi,
This is a feature request, or I’m simply not seeing it, which is entirely possible.
There is a “File” menu item to “Save as JSON file”.
Could you consider something similar when publishing, so that we can play around with weird and wonderful DIY scoring systems (without having to deconstruct the published HTML).
i.e. when publishing have a checkbox in the Options tab to “include data” (or something) which inserts the file data within the HTML script tags. Javascript data objects and JSON are almost identical, so it should be a simple tweak
One can then hide (or mine) the original HTML, calculate the results and generate new HTML.
It’s kinda like having scripted scoring systems and opens up lots of possibilities.
Apologies if there is already a way to do this a different way (without faffing with the JSON etc).
Cheers,
Colin
Hi Colin,
Currently Other than saving the series as JSON and working on that
There is a Plugin that has Publish results as XML, which was written for Sailing.today, it has the option to save to file but currently only handles One Design - it could be upgraded to support the handicap fleets. But I note you asked for JSON again it could be converted to JSON and/or XML
There is another possibility which is available with version 2.33 in the plugins which sends the results to the Irish Sailing Association this is all done using JSON although the JSON is structured to their specification
If we take the Sailwave example elapsed (attached)
elapsed.blw (45.3 KB)
This produces this as JSON
elapsed.JSON (19.3 KB)
If that is suitable for your use let me know and I’ll detail how to produce this from any .blw
Jon
Hi Jon,
I can see how to do it by faffing with the JSON.
What I was wondering is if the data could be optionally included in the published results. See link below (right-click view page source). It has the data included within the HTML script tags - facilitating custom scoring systems implemented as Sailwave effects, without the need for Sailwave to have scripting itself.
Hi Colin,
There are two problems with that
- Including all of the blw in the HTML means you are including data that is or may be private without any control and publishing it on the Web. e.g. Emails and Dates of Birth, and Medical conditions that are not published
The scorer decides what information is published
- The File size will become much larger.
1 Like
Hi Jon,
Well I don’t think file size really matters that much these days and obviously it could be tweaked to just include the published columns, but fair enough, it doesn’t sound like something you are interested in pursuing; I’ll DIY.
I have another request - can you consider adding min and max functions to the expression stuff?
Hi Colin,
I’m not saying that I’m not interested in pursuing it - I’m just trying to understand the requirements and the best /easiest way of implementing it - I misunderstood your first post I thought you wanted the results published in JSON.
If you have access to the .blw then it gives you the option to create this in JSON already.
It is interesting to see what could be done but it would take some thought to be careful about what is published in the HTML
Yes, I’m sure I could include a max and min in the expressions. Would it be of just 2 variables e.g. Max(r,s)?
Jon
I should have generalised more. Sailwave doesn’t have scripting. And it’s quite hard to add. But, looking through the posts here, it seemed to me that being able to implement ones own scoring system code as Sailwave effects would be a benefit - but the published page doesn’t necessarily have access to all data it needs. My idea was a stab at an easy solution but a little blunt I guess. If of interest to you and others, it could be refined by making the keys much shorter and only including data needed for scoring; which is still quite a lot but probably OK - the results, the scoring system used data, published cols and starts as well as a lot of the global data.
Or think of it another way. Sailwave has the concept of N scoring systems. Imagine a tab in a scoring system for the actual code (in Javascript, Lua, etc) that implements it. i.e. instead of being hard wired it becomes programmable. That is the ideal approach. My solution is a compromise in terms of implementation difficulty and functionality - because the user also has to generate the pretty results. Not perfect but very easy to implement and potentially useful to users who are coders or know coders.
re: min/max - yes 2 args - it would solve a problem somebody had last year. You can write an expression for min() using trunk() (I think) but it’s unwieldly.
Hi Colin,
My approach to this which I’ve been thinking of for quite some time was to do something similar to the NHC external mode where you create an excel template to score the race and sailwave feeds in the Data and reads the results from the Excel sheet. This would be fairly easy for simple rules for the races but it gets difficult when you come to scoring codes and perhaps discards. I think if this was done more people would have the skill to write an Excel template than to write a Javascript implementation
What do you think?
Jon
I think you are probably right that more people will find that accessible.