Harjotsingh has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/373310 )

Change subject: Add feedbackUnselected class to proposals that have not been 
attempted
......................................................................

Add feedbackUnselected class to proposals that have not been attempted

Currently feedback is shown for all proposals of all questions in a quiz
even if a question/proposal is not selected.This change changes the way feedback
is handled by checking if a proposal has been checked.It adds
feedbackDisplay class to not attempted question and uses CSS to hide/show
these questions.

Bug:T159952
Change-Id: I98b2a9fed27b15650acbb9d569dfed51b05c2e25
---
M Question.php
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Quiz 
refs/changes/10/373310/1

diff --git a/Question.php b/Question.php
index d9ae793..1a610c0 100644
--- a/Question.php
+++ b/Question.php
@@ -160,6 +160,7 @@
                $raws = preg_split( '`\n`s', $input, -1, PREG_SPLIT_NO_EMPTY );
                // Parameters used in some special cases.
                $expectOn = 0;
+               $attemptChecker = 0;
                $checkedCount = 0;
                foreach ( $raws as $proposalId => $raw ) {
                        $text = null;
@@ -200,6 +201,10 @@
                                        if ( $this->mBeingCorrected && 
$this->mRequest->getVal( $name ) == $value ) {
                                                $attribs['checked'] = 'checked';
                                        }
+                                       // Determine if the proposal has been 
attempted
+                                       $attemptChecker = ( 
$this->mBeingCorrected &&  $this->mRequest->getVal( $name ) === $value )
+                                               ? 1
+                                               : 0;
                                        // Determine the color of the cell and 
modify the state of the question.
                                        switch ( $sign ) {
                                                case '+':
@@ -262,7 +267,7 @@
                        } elseif ( preg_match( $this->mCorrectionPattern, $raw, 
$matches ) &&
                                $this->mBeingCorrected
                        ) {
-                               $rawClass = 'correction';
+                               $rawClass = $attemptChecker ? 'correction' : 
'correction feedbackUnselected';
                                $text = array_pop( $matches );
                                $signesOutput = '<td>&#x2192;</td>';
                                // Hacks to avoid counting the number of signes.

-- 
To view, visit https://gerrit.wikimedia.org/r/373310
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I98b2a9fed27b15650acbb9d569dfed51b05c2e25
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Quiz
Gerrit-Branch: master
Gerrit-Owner: Harjotsingh <harjo...@ymail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to