Skip to content

Instantly share code, notes, and snippets.

@rheajt
Last active November 24, 2016 07:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rheajt/42c48bebee8155213b5dd6f05f77ede4 to your computer and use it in GitHub Desktop.
Save rheajt/42c48bebee8155213b5dd6f05f77ede4 to your computer and use it in GitHub Desktop.
/**
* Return, rewrite, regrade
*
* @param {number} The original grade
* @param {number} The re-graded assignment
* @param {number} The percentage of the regraded assignment to count
* @return The curved grade
* @customfunction
*/
function REGRADEDCURVE(original, newGrade, percentage) {
var regraded = original + (newGrade - original) * (percentage * .01);
return regraded;
}
/**
* Flat curve
*
* @param {number} Original grade
* @param {number} Number to add to grade
* @return The curved grade
* @customfunction
*/
function FLATCURVE(original, flat) {
return original + flat;
}
/**
* High Grade to a 100%
*
* @param {number} Highest grade
* @param {number} Grade to be curved
* @return The curved grades
* @customfunction
*/
function HIGHCURVE(highGrade, grade) {
return Math.round((100 * grade) / highGrade);
}
/**
* Linear Scale
*
* @param {number} The AVERAGE of the grades
* @param {number} The DESIRED AVERAGE of the grades
* @param {number} The LOWEST or HIGHEST grade
* @param {number} The DESIRED LOW or HIGH grade
* @param {number} The grade to be curved
* @return The curved grade
* @customfunction
*/
function LINEARCURVE(x0, y0, x1, y1, grade) {
return Math.round(y0 + ((y1 - y0) / (x1 - x0)) * (grade - x0));
}
/**
* Root Curve
*
* @param {number} The grade to curve
* @return The curved grade
* @customfunction
*/
function ROOTCURVE(grade) {
return Math.round(Math.pow((100 * Math.pow(grade, 2)), 1/3));
}
/**
* Bell Curve
*
* @param {number} The grade to curve
* @customfunction
*/
function BELLCURVE(grade) {
return 'Please do not use this curve!';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment