Closed philderbeast closed 3 years ago
@biuti when importing this fsdb file the lead factor is set to null in the DB. I think that this should be set to 0 (there maybe other similar errors on importing a null instead of zero.
@philderbeast as a work around until the import is fixed, you can go to comp settings -> formula -> advanced and set the lead factor to 0 and save. There is a bug here that it shows 1.00 even after saving but the DB gets updated to 0. then hopefully the scoring should work. opened issue #206
@philderbeast as a work around until the import is fixed, you can go to comp settings -> formula -> advanced and set the lead factor to 0 and save.
That works thanks @kuaka.
the formula is created like this:
formula.lead_factor = ( None if form.get('use_leading_points') == '0' else float(form.get('leading_weight_factor') if form.get('leading_weight_factor') else 1) )
So it is set to null when leading points are not used. From FSDB we take Formula for competition and TaskFormula for each task.
Probably in that competition they put departure points = off in the competition, that is wrong if you intend to use them even in just one task.
We don't have a _leading_weightfactor at task level in database as it should not change during the whole comp.
In that FSDB version there isn't at any level anyway as there was no setting for the factor back in 2017.
It is quite a strange case that should really never happen if comp setting is done right in FS.
We have a lot of parameters set as None when they can be used as a boolean if it should not be used. JTG or SS_interval are some examples.
Not sure we want to change this. Probably we can add a check that if at least a task has leading points, then lead factor cannot be None or 0 (should be set to 1). But again, we should set Comp formula with dep = 'leadout' and _leadfactor = 1, and then set dep = 'off' in tasks where they are not used.
the formula is created like this:
formula.lead_factor = ( None if form.get('use_leading_points') == '0' else float(form.get('leading_weight_factor') if form.get('leading_weight_factor') else 1) )
this looks like the creation from the form not the fsdb. Regardless it is strange that we set something to null then in the form display it as 1 (even if it was 0 we displayed it as 1 but in my commit yesterday I fixed that at least). What is displayed on the form should reflect reality especially if there is a chance that the user will not save the form and therefore overwrite the null with the forms default value.. this is likely not to happen with imported comps
So it is set to null when leading points are not used. From FSDB we take Formula for competition and TaskFormula for each task. Probably in that competition they put departure points = off in the competition, that is wrong if you intend to use them even in just one task.
you can see exactly what is was in the FSDB file liked above. Here is an extract:
<FsScoreFormula id="GAP2016" use_distance_points="1" use_time_points="1" use_departure_points="0" use_leading_points="0"
........
<FsTask id="1" name="day one" tracklog_folder="day one">
<FsScoreFormula id="GAP2016" use_distance_points="1" use_time_points="1" use_departure_points="0" use_leading_points="0"
.......
<FsTask id="2" name="day four T2" tracklog_folder="day four">
<FsScoreFormula id="GAP2016" use_distance_points="1" use_time_points="1" use_departure_points="0" use_leading_points="1"
So they are using leading points for some tasks and not others. Whether it was done 'right' or 'wrong' in FS is moot as FS created this file and FS sets the standard when it comes to FSDB files. If airScore imports it, it should be able to cope with the settings in it. I don't understand why we need to set the leading weight to null if lead points are not used. If lead points are not used then (I hope) the calculation will not run so it could be set to any number, if LP are used then having a null is going to cause this error. proposed solution - set LP weight to 1 when not specified (the form will show 1 anyway.. the form should reflect reality or vice versa) then if LP are used at least airScore will not crash.
defaulted to 1 in database and object. Your commit makes it compatible with older database version. (https://github.com/FAI-CIVL/FAI-Airscore/commit/eb66a069f791271342803895c606bdd8c96a63cc)
On branch flare_timing_yaml at 1152378aabeb6e6459edff6f7333a3e7edf62acb, scoring tasks 2, 3, 4 or 5 of Dalby 2017 errors with:
Scoring the 1st task completes without this error. This first task doesn't have leading points.