Physikerwelt has uploaded a new change for review.
https://gerrit.wikimedia.org/r/259676
Change subject: Suggest that every formula is reviewed twice
......................................................................
Suggest that every formula is reviewed twice
Change-Id: I71fdecad497d5820e8ca781809ec5c307705a26c
---
M includes/special/SpecialMlpEval.php
1 file changed, 25 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MathSearch
refs/changes/76/259676/1
diff --git a/includes/special/SpecialMlpEval.php
b/includes/special/SpecialMlpEval.php
index 1212bbb..b45e19c 100644
--- a/includes/special/SpecialMlpEval.php
+++ b/includes/special/SpecialMlpEval.php
@@ -122,10 +122,10 @@
$nextStep = $this->getNextStep();
if ( $nextStep !== 5 ) {
$this->subStep = $nextStep;
- $this->writeLog( "User updates step 4." );
+ $this->writeLog( "User updates step 4.",4 );
return 4;
} else {
- $this->writeLog( "User completes step 4." );
+ $this->writeLog( "User completes step 4.",4 );
return $this->setStep( 5 );
}
}
@@ -138,7 +138,7 @@
array_merge( $this->identifiers,
preg_split( '/[\n\r]/', $missing ) );
}
}
- $this->writeLog( "User completes step ".$req->getInt( 'oldStep'
) );
+ $this->writeLog( "User completes step ".$req->getInt( 'oldStep'
), $req->getInt( 'oldStep', 0 ) );
return $this->setStep( $req->getInt( 'oldStep' ) + 1 );
}
@@ -451,13 +451,16 @@
}
- private function writeLog( $message, $step = 0, $revId = false ) {
+ private function writeLog( $message, $step = false, $revId = false ) {
$userId = $this->getUser()->getId();
$logData = array(
'data' => $this->getRequest()->getValues(),
'header' => $this->getRequest()->getAllHeaders()
);
$json = json_encode( $logData );
+ if ( $step == false ){
+ $step = $this->step;
+ }
if ( !$revId ) {
$revId = $this->oldId;
}
@@ -475,6 +478,24 @@
}
$dbw = wfGetDB( DB_WRITE );
$dbw->upsert( 'math_mlp', $row, array( 'user_id',
'revision_id', 'anchor', 'step' ), $row );
+ if ( $this->fId ) {
+ $dbw->begin();
+ $cnt = $dbw->selectField( 'math_mlp', 'count( distinct
user_id)', array(
+ 'revision_id' => $revId,
+ 'anchor' => $this->fId
+ ) );
+ if ( $cnt == 1 ){
+ $row = array(
+ 'revision_id' => $revId,
+ 'anchor' => $this->fId,
+ 'priority' => 2
+ );
+ $dbw->upsert( 'math_review_list', $row, array(
'revision_id', 'anchor'), $row );
+ } elseif( $cnt > 1 ) {
+ $dbw->delete( 'math_review_list', array(
'revision_id', 'anchor') );
+ }
+ $dbw->commit();
+ }
}
private function resetPage() {
--
To view, visit https://gerrit.wikimedia.org/r/259676
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I71fdecad497d5820e8ca781809ec5c307705a26c
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