fixed math on javascript function to detect how many disciplines are spent