fix comparison problem caused by javascript comparisons based on Strings. ("1.00" <= "1.0" --> false)

This commit is contained in:
Ralf Teusner
2016-06-16 11:38:16 +02:00
parent e086a44a2b
commit fbb83e3057

View File

@ -704,8 +704,8 @@ $(function() {
}; };
var renderScore = function() { var renderScore = function() {
var score = $('#score').data('score'); var score = parseFloat($('#score').data('score'));
var maxium_score = $('#score').data('maximum-score'); var maxium_score = parseFloat($('#score').data('maximum-score'));
if (score >= 0 && score <= maxium_score && maxium_score >0 ) { if (score >= 0 && score <= maxium_score && maxium_score >0 ) {
var percentage_score = (score / maxium_score * 100 ).toFixed(0); var percentage_score = (score / maxium_score * 100 ).toFixed(0);
$('.score').html(percentage_score + '%'); $('.score').html(percentage_score + '%');