Physikerwelt has uploaded a new change for review.

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

Change subject: Adjust formula suggestion logic
......................................................................

Adjust formula suggestion logic

Change-Id: I6eb72e693102c44c58c434fcc0ce9eac850b1d72
---
M includes/special/SpecialMlpEval.php
1 file changed, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MathSearch 
refs/changes/70/259670/1

diff --git a/includes/special/SpecialMlpEval.php 
b/includes/special/SpecialMlpEval.php
index adc965b..1212bbb 100644
--- a/includes/special/SpecialMlpEval.php
+++ b/includes/special/SpecialMlpEval.php
@@ -327,6 +327,24 @@
         * @throws MWException
         */
        private function getRandomFId() {
+               try{
+                       $uid = $this->getUser()->getId();
+                       $rid = $this->revision->getId();
+                       $dbr = wfGetDB( DB_READ );
+                       // Note that the math anchor is globally unique
+                       $results = $dbr->selectFieldValues( 'math_review_list', 
'anchor',
+                               "anchor not in (SELECT anchor from math_mlp 
where user_id = $uid ".
+                               "and anchor is not NULL) and revision_id = 
$rid",
+                               __METHOD__, array(
+                                       'LIMIT'    => 1,
+                                       'ORDER BY' => 'priority desc'
+                               ) );
+                       if ( $results ) {
+                               return $results[0];
+                       }
+               } catch ( Exception $e ){
+                       // empty
+               }
                $unique = array_rand( $this->mathIdGen->getMathTags() );
                return $this->mathIdGen->parserKey2fId( $unique );
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6eb72e693102c44c58c434fcc0ce9eac850b1d72
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MathSearch
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <[email protected]>

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

Reply via email to