Feedback about JOIN Cycling App

@Jan_T could you check this please? Or provide the script?

It’s a “custom activity field”, added through Activities > Any activity > Custom (not Fields, which confusingly has some similarly named fields which do not work).

Here is the script:

ctl = activity.icu_ctl
if (ctl == null) {
  let w = Math.exp(-1 / 42.0)
  ctl = icu.wellness.ctl * w + activity.icu_training_load * (1 - w)}

function erf(x)
{
    //A&S formula 7.1.26
  
  var ans = 0;
    var a1 = 0.254829592;
    var a2 = -0.284496736;
    var a3 = 1.421413741;
    var a4 = -1.453152027;
    var a5 = 1.061405429;
    var p = 0.3275911;
    x = Math.abs(x);
    var t = 1 / (1 + p * x);
    //Horner's method, takes O(n) operations for nth order polynomial
    ans = 1 - ((((((a5 * t + a4) * t) + a3) * t + a2) * t) + a1) * t * Math.exp(-1 * x * x);
    return ans; 
}

function NORMSDIST(z)
{
    var ans = 0;
    var sign = 1;
    if (z < 0) sign = -1;
    ans = 0.5 * (1.0 + sign * erf(Math.abs(z)/Math.sqrt(2)));
    return ans;
}
// activity.icu_ftp
// activity.icu_weight
// activity.icu_ctl

JoinScore = ctl*(0.135*Math.exp(-Math.pow(activity.icu_ftp/activity.icu_weight-3,2)/(2*Math.pow(0.85,2)))+0.175) + NORMSDIST(activity.icu_ftp/activity.icu_weight*1.7-6.5)*28.7-3.35