jenkins-bot has submitted this change and it was merged.

Change subject: Separate distinct value checks
......................................................................


Separate distinct value checks

As partially suggested by aude in
https://gerrit.wikimedia.org/r/#/c/232279/8/specials/SpecialCrossCheck.php

Change-Id: I9425bd2bcd95151597dd7d3889cdf4853a2319cb
---
M specials/SpecialCrossCheck.php
1 file changed, 17 insertions(+), 3 deletions(-)

Approvals:
  Hoo man: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/specials/SpecialCrossCheck.php b/specials/SpecialCrossCheck.php
index b7245cd..fe2b9c6 100644
--- a/specials/SpecialCrossCheck.php
+++ b/specials/SpecialCrossCheck.php
@@ -12,6 +12,7 @@
 use Traversable;
 use ValueFormatters\FormatterOptions;
 use ValueFormatters\ValueFormatter;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\EntityIdParser;
 use Wikibase\DataModel\Entity\EntityIdParsingException;
@@ -171,16 +172,16 @@
                                return;
                        }
 
-                       if ( !( $entity instanceof StatementListProvider ) ) {
+                       if ( $entity === null ) {
                                $out->addHTML(
                                        
$this->buildNotice('wbqev-crosscheck-not-existent-entity', true)
                                );
                                return;
                        }
 
-                       $results = 
$this->crossCheckInteractor->crossCheckStatementList( $entity->getStatements() 
);
+                       $results = $this->getCrossCheckResultsFromEntity( 
$entity );
 
-                       if ($results && count($results) > 0) {
+                       if ( count($results) > 0 ) {
                                $out->addHTML(
                                        $this->buildResultHeader($entityId)
                                        . $this->buildSummary($results)
@@ -196,6 +197,19 @@
        }
 
        /**
+        * @param EntityDocument $entity
+        *
+        * @return CrossCheckResultList
+        */
+       private function getCrossCheckResultsFromEntity( EntityDocument $entity 
) {
+               if ( $entity instanceof StatementListProvider ) {
+                       return 
$this->crossCheckInteractor->crossCheckStatementList( $entity->getStatements() 
);
+               }
+
+               return new CrossCheckResultList();
+       }
+
+       /**
         * Builds html form for entity id input
         */
        private function buildEntityIdForm() {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9425bd2bcd95151597dd7d3889cdf4853a2319cb
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/WikibaseQualityExternalValidation
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Jonas Kress (WMDE) <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to