Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lsolesen committed Aug 13, 2021
1 parent fca7c6b commit 09c0124
Show file tree
Hide file tree
Showing 6 changed files with 265 additions and 251 deletions.
154 changes: 90 additions & 64 deletions assets/js/1rm.js
Original file line number Diff line number Diff line change
@@ -1,96 +1,122 @@
let motionsplan = {};

motionsplan.Estimate1RM = function(weight, repetitions)
{
motionsplan.Estimate1RM = function(weight, repetitions) {
var weight, repetitions;

weight = weight;
repetitions = repetitions;

function getBrzycki() {
return Math.round(weight*(36/(37-repetitions)));
}
function getEpley() {
return Math.round((1 + (0.0333*repetitions))*weight);
}
function getLander() {
return Math.round((100*weight)/(101.3 - 2.67123*repetitions));
}

function getLombardi() {
return Math.round(weight*(Math.pow(repetitions,0.1)));
}

function getMayhewetal() {
return Math.round((100*weight)/(52.2 + (41.9*Math.exp(-0.055*repetitions))));
}
function getOconneretal() {
return Math.round(weight*(1 + 0.025*repetitions));
}
function getWathan() {
return Math.round((100*weight)/(48.8 + (53.8*Math.exp(-0.075*repetitions))));
}

/**
* Advanced - originally from motion-online.dk.
*/
function getMOL(trained, sex)
{
var trained, koen;
trained = trained;
koen = sex;
return Math.round(weight * (36 / (37 - repetitions)));
}

function getEpley() {
return Math.round((1 + (0.0333 * repetitions)) * weight);
}

function getLander() {
return Math.round((100 * weight) / (101.3 - 2.67123 * repetitions));
}

function getLombardi() {
return Math.round(weight * (Math.pow(repetitions, 0.1)));
}

function getMayhew() {
return Math.round((100 * weight) / (52.2 + (41.9 * Math.exp(-0.055 * repetitions))));
}

function getOconnor() {
return Math.round(weight * (1 + 0.025 * repetitions));
}

function getWathan() {
return Math.round((100 * weight) / (48.8 + (53.8 * Math.exp(-0.075 * repetitions))));
}

/**
* Advanced - originally from motion-online.dk.
* https://www.motion-online.dk/rm-beregner/
* https://www.motion-online.dk/rm-beregner-teoretisk-baggrund/
*/
function getMOL(trained, sex) {
var trained, koen;
trained = trained;
koen = sex;

if (koen == 1 && trained == 1) {
var a = -2.1021, b = 102.52;
var a = -2.1021,
b = 102.52;
}
else if (koen == 1 && trained == 0) {
var a = -2.6578, b = 102.65;
var a = -2.6578,
b = 102.65;
}
else if (koen == 0 && trained == 1) {
var a = -2.1275, b = 101.59;
var a = -2.1275,
b = 101.59;
}
else if (koen == 0 && trained == 0) {
var a = -2.6914, b = 102.14;
var a = -2.6914,
b = 102.14;
}
if (repetitions == 1) {
var repmax = weight;
var repmax = weight;
}
else {
var repmax=weight/(a*repetitions+b)*100;
var repmax = weight / (a * repetitions + b) * 100;
}

return repmax;
}
/*
$scope.percentOfRm = function(rm, percent) {
return rm * percent / 100;
};
$scope.calcRM = function(rm, number) {
var a = -2.78;
var b = 102.78;
return Math.round(((a*number+b)*rm/100) * Math.pow(10,1))/Math.pow(10,1);
};*/

/**
* From motion-online RM calculator
*/
function getMOLBryzki()
{
var a = -2.78, b = 102.78;
if (repetitions == 1) {
var repmax = weight;
}
else {
var repmax = weight / (a * repetitions + b) * 100;
}

return repmax;
}

/*
$scope.percentOfRm = function(rm, percent) {
return rm * percent / 100;
};
$scope.calcRM = function(rm, number) {
var a = -2.78;
var b = 102.78;
return Math.round(((a*number+b)*rm/100) * Math.pow(10,1))/Math.pow(10,1);
};*/

var publicAPI = {
getBrzycki : getBrzycki,
getEpley : getEpley,
getLander : getLander,
getLombardi : getLombardi,
getMayhewetal : getMayhewetal,
getOconneretal : getOconneretal,
getWathan : getWathan,
getMOL : getMOL

};

return publicAPI;
getBrzycki: getBrzycki,
getEpley: getEpley,
getLander: getLander,
getLombardi: getLombardi,
getMayhew: getMayhew,
getOconnor: getOconnor,
getWathan: getWathan,
getMOL: getMOL,
getMOLBryzki : getMOLBryzki

};

return publicAPI;
}

module.exports = motionsplan;

/* Bryzki og avanceret fra motion-online
https://www.motion-online.dk/rm-beregner/
https://www.motion-online.dk/rm-beregner-teoretisk-baggrund/
function Calculate1(thisform)
{
reps = thisform.reps.value;
Expand Down
Loading

0 comments on commit 09c0124

Please sign in to comment.