jenkins-bot has submitted this change and it was merged.
Change subject: Simplify down to a single threshold
......................................................................
Simplify down to a single threshold
The UI doesn't support more than a single threshold, so remove vestigal
support.
Bug: T112856
Change-Id: I4fd5043758be28df025ecba8e30e0552aa42103f
---
M extension.json
M includes/Hooks.php
M includes/Scoring.php
3 files changed, 8 insertions(+), 42 deletions(-)
Approvals:
Ladsgroup: Looks good to me, but someone else must approve
Awight: Looks good to me, approved
jenkins-bot: Verified
diff --git a/extension.json b/extension.json
index 403b52a..64d0b53 100644
--- a/extension.json
+++ b/extension.json
@@ -53,14 +53,9 @@
"reverted",
"wp10"
],
- "OresDamagingTagThresholds": {
- "low": 0.8,
- "medium": 0.87,
- "high": 0.94
- },
- "OresDamagingFilterThreshold": 0.87,
+ "OresDamagingThreshold": 0.87,
"RecentChangesFlags": {
- "damagingRisk": {
+ "damaging": {
"letter": "ores-damaging-letter",
"title": "ores-damaging-title",
"legend": "ores-damaging-legend",
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 389ccb7..e41dcfb 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -73,7 +73,7 @@
$name, array &$tables, array &$fields, array &$conds,
array &$query_options, array &$join_conds, FormOptions $opts
) {
- global $wgOresDamagingFilterThreshold;
+ global $wgOresDamagingThreshold;
$tables[] = 'ores_classification';
$fields[] = 'ores_probability';
@@ -85,7 +85,7 @@
// Filter out non-damaging edits.
$conds[] = 'ores_is_predicted = 1';
$conds[] = 'ores_probability > '
- . wfGetDb( DB_SLAVE )->addQuotes(
$wgOresDamagingFilterThreshold );
+ . wfGetDb( DB_SLAVE )->addQuotes(
$wgOresDamagingThreshold );
}
return true;
@@ -126,14 +126,11 @@
* Internal helper to label matching rows
*/
protected static function processRecentChangesList( RCCacheEntry
$rcObj, array &$data ) {
- $score = $rcObj->getAttribute( 'ores_probability' );
- if ( $score !== null ) {
- $type = Scoring::getDamagingThreshold( $score );
+ global $wgOresDamagingThreshold;
- if ( $type ) {
- $data['recentChangesFlags']['damaging'] = true;
- // TODO: Stash the details in HTML so they can
be retrieved by JS?
- }
+ $score = $rcObj->getAttribute( 'ores_probability' );
+ if ( $score && $score >= $wgOresDamagingThreshold ) {
+ $data['recentChangesFlags']['damaging'] = true;
}
}
}
diff --git a/includes/Scoring.php b/includes/Scoring.php
index e75abcc..1c9d517 100644
--- a/includes/Scoring.php
+++ b/includes/Scoring.php
@@ -45,32 +45,6 @@
return $wireData;
}
- /**
- * @return string|null Threshold exceeded, or null if none.
- *
- * TODO: Should be in a model-specific module.
- */
- public static function getDamagingThreshold( $score ) {
- global $wgOresDamagingTagThresholds;
-
- $score = floatval( $score );
- $type = null;
-
- // Find the nearest threshold exceeded by $score.
- $highestExceededThreshold = null;
- foreach ( $wgOresDamagingTagThresholds as $name => $threshold )
{
- if ( $score >= $threshold
- // Ignore threshold if it's further from $score.
- && ( $threshold > $highestExceededThreshold ||
$highestExceededThreshold === null )
- ) {
- $type = $name;
- $highestExceededThreshold = $threshold;
- }
- }
- return $type;
- }
-
-
public static function instance() {
return new self();
}
--
To view, visit https://gerrit.wikimedia.org/r/257856
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4fd5043758be28df025ecba8e30e0552aa42103f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Awight <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits