From bbaeef0b35e7bb718e78cb301dddaef8a2758f62 Mon Sep 17 00:00:00 2001 From: Lars Olesen Date: Sun, 17 Apr 2022 19:21:20 +0200 Subject: [PATCH 1/3] Fixes --- src/js/strength.js | 30 +++++++++++++++++++++++++----- src/test/strength.js | 22 +++++++++++++++++++++- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/src/js/strength.js b/src/js/strength.js index 7f6aa15cd24e..898cc0e97665 100644 --- a/src/js/strength.js +++ b/src/js/strength.js @@ -5,13 +5,33 @@ motionsplan.Strength = function(weight, body_weight) { body_weight = body_weight; function getIndex100() { - let Loeft = weight; - let Vaegt = body_weight; - return Math.round(Loeft * 986.63 / (1270.4 - 172970 * ((Math.pow(Vaegt, -1.3925)))) * Math.pow(10, 0)) / Math.pow(10, 0) + let Loeft = weight; + let Vaegt = body_weight; + return Loeft * 986.63 / (1270.4 - 172970 * ((Math.pow(Vaegt, -1.3925)))); + } + + function getAllometricScaling() { + let S = weight; + let M = body_weight; + return S * Math.pow(M, -2/3); + } + + function getBodyweightPercent() { + return weight / body_weight; + } + + function getNuckolsIndex() { + var a, b; + var w = weight; + var bw = body_weight; + + return 100*w/(a*Math.pow(bw, 2)+b*bw); } - let publicAPI = { - getIndex100: getIndex100 + var publicAPI = { + getIndex100 : getIndex100, + getAllometricScaling : getAllometricScaling, + getBodyweightPercent : getBodyweightPercent }; return publicAPI; diff --git a/src/test/strength.js b/src/test/strength.js index 25185aff6d7d..5f67b3123a38 100644 --- a/src/test/strength.js +++ b/src/test/strength.js @@ -6,7 +6,27 @@ describe('Strength', function() { it('should return the correct number', function() { // weigt, reps let rm = motionsplan.Strength(80, 80); - assert.equal(rm.getIndex100(), 89); + assert.equal(rm.getIndex100(), 89.36709244049503); + }); + }); + describe('getAllometricScaling', function() { + it('should return the correct number', function() { + // weigt, reps + var rm = motionsplan.Strength(405, 220); + assert.equal(rm.getAllometricScaling(), 11.11321976546847); + + var rm = motionsplan.Strength(300, 150); + assert.equal(rm.getAllometricScaling(), 10.626585691826113); + }); + }); + describe('getBodyweightPercent', function() { + it('should return the correct number', function() { + // weigt, reps + var rm = motionsplan.Strength(405, 220); + assert.equal(rm.getBodyweightPercent(), 1.8409090909090908); + + var rm = motionsplan.Strength(300, 150); + assert.equal(rm.getBodyweightPercent(), 2); }); }); }); From b9ab3a7e2d3cf47d6435bc7445a9f4e4f2c17f54 Mon Sep 17 00:00:00 2001 From: Lars Olesen Date: Sun, 17 Apr 2022 19:24:21 +0200 Subject: [PATCH 2/3] Fixes --- src/test/strength.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/test/strength.js b/src/test/strength.js index 5f67b3123a38..b7846f23ca76 100644 --- a/src/test/strength.js +++ b/src/test/strength.js @@ -12,20 +12,24 @@ describe('Strength', function() { describe('getAllometricScaling', function() { it('should return the correct number', function() { // weigt, reps - var rm = motionsplan.Strength(405, 220); + let rm = motionsplan.Strength(405, 220); assert.equal(rm.getAllometricScaling(), 11.11321976546847); - - var rm = motionsplan.Strength(300, 150); + }); + }); + describe('getAllometricScalingSecondTry', function() { + it('should return the correct number', function() { + let rm = motionsplan.Strength(300, 150); assert.equal(rm.getAllometricScaling(), 10.626585691826113); }); }); describe('getBodyweightPercent', function() { it('should return the correct number', function() { // weigt, reps - var rm = motionsplan.Strength(405, 220); + let rm = motionsplan.Strength(405, 220); assert.equal(rm.getBodyweightPercent(), 1.8409090909090908); - - var rm = motionsplan.Strength(300, 150); + }); + it('should return the correct number', function() { + let rm = motionsplan.Strength(300, 150); assert.equal(rm.getBodyweightPercent(), 2); }); }); From 6a915e7a0b10db305546f5573d4ae252aa755046 Mon Sep 17 00:00:00 2001 From: Lars Olesen Date: Sun, 17 Apr 2022 19:24:46 +0200 Subject: [PATCH 3/3] Fixes --- src/js/strength.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js/strength.js b/src/js/strength.js index 898cc0e97665..b8a2d277e557 100644 --- a/src/js/strength.js +++ b/src/js/strength.js @@ -21,14 +21,14 @@ motionsplan.Strength = function(weight, body_weight) { } function getNuckolsIndex() { - var a, b; - var w = weight; - var bw = body_weight; + let a, b; + let w = weight; + let bw = body_weight; return 100*w/(a*Math.pow(bw, 2)+b*bw); } - var publicAPI = { + let publicAPI = { getIndex100 : getIndex100, getAllometricScaling : getAllometricScaling, getBodyweightPercent : getBodyweightPercent