Kaldari has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/179300

Change subject: Fix EventLogging of responses when correct is null
......................................................................

Fix EventLogging of responses when correct is null

If you want EventLogging to record NULL for a boolean field, you
can't pass null for the value. Instead, you have to not pass the
property at all.

Change-Id: I7c28f9f7b709a861a775b60f2d762ce57317768b
(cherry picked from commit 838c2b09310b699b6588346f2e9d07ede2e6f9d8)
---
M includes/api/ApiResponse.php
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiGrok 
refs/changes/00/179300/1

diff --git a/includes/api/ApiResponse.php b/includes/api/ApiResponse.php
index 202bce7..1d12879 100644
--- a/includes/api/ApiResponse.php
+++ b/includes/api/ApiResponse.php
@@ -54,8 +54,12 @@
                                'property' => $claim['prop'],
                                'valueId' => $claim['valueid'],
                                'value' => $claim['value'],
-                               'response' => $claim['correct'],
                        );
+                       // Since EventLogging doesn't allow null for boolean 
fields (even when they
+                       // are optional) only set 'response' when 'correct' is 
true or false.
+                       if ( $claim['correct'] === true || $claim['correct'] 
=== false ) {
+                               $event['response'] = $claim['correct'];
+                       }
                        $result = $eventLogger->logEvent(
                                self::SCHEMA,
                                self::SCHEMA_REV_ID,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c28f9f7b709a861a775b60f2d762ce57317768b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiGrok
Gerrit-Branch: wmf/1.25wmf11
Gerrit-Owner: Kaldari <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to