Lucas Werkmeister (WMDE) has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/354495 )
Change subject: Sort constraint results by constraint type
......................................................................
Sort constraint results by constraint type
If two constraint results do not differ in anything else, sort them by
the constraint type, to ensure that constraint results for the same
constraint type are grouped together. This especially matters for the
output of the constraint-displaying user script, since the constraints
shown in a single report pop-up already share the other aspects that the
sorting takes into account (status, property, statement).
Properties with multiple constraints of the same type are not common,
but not unheard of either; constraints like “Item” (item requires claim)
or “Conflicts with” can be specified with completely different
parameters. The following query finds such properties:
SELECT DISTINCT ?property ?propertyLabel ?constraintLabel WHERE {
?property a wikibase:Property;
p:P2302 ?statement1, ?statement2.
?constraint ^ps:P2302 ?statement1, ?statement2.
FILTER(?statement1 != ?statement2).
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Change-Id: I2dfabdd725ad290a9b04390f94d0bb9d0b932110
---
M includes/ConstraintCheck/DelegatingConstraintChecker.php
1 file changed, 8 insertions(+), 1 deletion(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints
refs/changes/95/354495/1
diff --git a/includes/ConstraintCheck/DelegatingConstraintChecker.php
b/includes/ConstraintCheck/DelegatingConstraintChecker.php
index debdca9..5bcbcf2 100644
--- a/includes/ConstraintCheck/DelegatingConstraintChecker.php
+++ b/includes/ConstraintCheck/DelegatingConstraintChecker.php
@@ -277,7 +277,14 @@
$hashB = $b->getStatement()->getHash();
if ( $hashA === $hashB ) {
- return 0;
+ $nameA =
$a->getConstraintName();
+ $nameB =
$b->getConstraintName();
+
+ if ( $nameA == $nameB ) {
+ return 0;
+ } else {
+ return ( $nameA >
$nameB ) ? 1 : -1;
+ }
} else {
return ( $hashA > $hashB ) ? 1
: -1;
}
--
To view, visit https://gerrit.wikimedia.org/r/354495
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2dfabdd725ad290a9b04390f94d0bb9d0b932110
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits