Skip to content
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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

evarisk-charles
Copy link
Contributor

No description provided.

@@ -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;
Copy link
Contributor

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

Comment on lines +901 to +910
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>');
}
?>
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 Enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

Changement de la couleur de la barre de progression en fonction du % de progression renseigné
2 participants