isenseDev/iSENSE — pull request #172 by cadorett (2012-05-17 15:54:51+00:00)
Title: Fixing TSOR display issue referenced by Fred / Overloading lesson.

Not sure who wrote the avgField functions in modifier.js, however you cannot overload in the traditional sense in JS. You definitely cannot do this and expect lifelong success
data.avgField = function(oneargument){..};
data.avgField = function(oneargument,twoargument){...};

You probably can guess what this does. (Overwrite the first function into nothingness since it is just a variable).

One way of overloading in JavaScript can be taking advantage of the fact that javascript doesn't verify the number of arguments passed.

You can simply do something like this in the case above (This is how I fixed it):

data.avgField = function(oneargument, twoargument) {
//Do some stuff
if(!twoargument) {//Do some stuff if this argument was not passed}
else {//do some stuff if the argument was passed}
// Do some more stuff
}