-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#1893 [Control] add: progress bar of different colors #1913
base: develop
Are you sure you want to change the base?
#1893 [Control] add: progress bar of different colors #1913
Conversation
@@ -896,7 +896,18 @@ | |||
<div class="progress-info"> | |||
<span class="badge badge-info" style="margin-right: 10px;"><?php print $answerCounter . '/' . $questionCounter; ?></span> | |||
<div class="progress-bar" style="margin-right: 10px;"> | |||
<div class="progress progress-bar-success" style="width:<?php print ($questionCounter > 0 ? ($answerCounter / $questionCounter) * 100 : 0) . '%'; ?>;" title="<?php print($questionCounter > 0 ? $answerCounter . '/' . $questionCounter : 0); ?>"></div> | |||
<?php | |||
$percentage = ($answerCounter / $questionCounter) * 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ici il y a un problème structurel
Le code ne protège pas de la division par 0
C'est pas de ton fait car c'est pas check plus haut mais si tu fait rien ca reste une fatal possible
if ($percentage == 0) { | ||
print ('<div class="progress progress-bar-danger" style="width: 0%;" title="' . ($questionCounter > 0 ? $answerCounter . '/' . $questionCounter : 0) . '"></div>'); | ||
} | ||
if ($percentage > 0 && $percentage < 100) { | ||
print ('<div class="progress progress-bar-warning" style="width:' . ($questionCounter > 0 ? ($answerCounter / $questionCounter) * 100 : 0) . '%;" title="' . ($questionCounter > 0 ? $answerCounter . '/' . $questionCounter : 0) . '"></div>'); | ||
} | ||
if ($percentage == 100) { | ||
print ('<div class="progress progress-bar-success" style="width: 100%;" title="' . ($questionCounter > 0 ? $answerCounter . '/' . $questionCounter : 0) . '"></div>'); | ||
} | ||
?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ca passe en soit mais pourquoi ne pas utiliser l'attribut html progress car la c'est pas posssible
No description provided.