Merge pull request #57 from openHPI/percentage-instead-score
Percentage instead score
This commit is contained in:
@ -706,7 +706,13 @@ $(function() {
|
|||||||
var renderScore = function() {
|
var renderScore = function() {
|
||||||
var score = $('#score').data('score');
|
var score = $('#score').data('score');
|
||||||
var maxium_score = $('#score').data('maximum-score');
|
var maxium_score = $('#score').data('maximum-score');
|
||||||
$('.score').html((score || '?') + ' / ' + maxium_score);
|
if (score >= 0 && score <= maxium_score && maxium_score >0 ) {
|
||||||
|
var percentage_score = (score / maxium_score * 100 ).toFixed(0);
|
||||||
|
$('.score').html(percentage_score + '%');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('.score').html( 0 + '%');
|
||||||
|
}
|
||||||
renderProgressBar(score, maxium_score);
|
renderProgressBar(score, maxium_score);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user