Kaldari has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/339588 )
Change subject: Fix bug where assessment isn't recorded when project title is cleaned ...................................................................... Fix bug where assessment isn't recorded when project title is cleaned Bug: T158932 Change-Id: I96981c30e0c6c88b2350ff151628517693b05916 --- M PageAssessmentsBody.php 1 file changed, 7 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageAssessments refs/changes/88/339588/1 diff --git a/PageAssessmentsBody.php b/PageAssessmentsBody.php index 24f3eb9..44be1bd 100644 --- a/PageAssessmentsBody.php +++ b/PageAssessmentsBody.php @@ -46,11 +46,15 @@ // Compile a list of projects found in the parserData to find out which // assessment records need to be inserted, deleted, or updated. $projects = array(); - foreach ( $assessmentData as $parserData ) { + foreach ( $assessmentData as $key => $parserData ) { // If the name of the project is set... if ( isset( $parserData[0] ) && $parserData[0] !== '' ) { + // Clean the project name. $projectName = self::cleanProjectTitle( $parserData[0] ); - // ...get the corresponding ID from page_assessments_projects table. + // Replace the original project name with the cleaned project + // name in the assessment data, since we'll need it to match later. + $assessmentData[$key][0] = $projectName; + // Get the corresponding ID from page_assessments_projects table. $projectId = self::getProjectId( $projectName ); // If there is no existing project by that name, add it to the table. if ( $projectId === false ) { @@ -76,7 +80,7 @@ $i = 0; - // Add and update records to the database + // Add and update assessment records to the database foreach ( $assessmentData as $parserData ) { $projectId = $projects[$parserData[0]]; if ( $projectId && $pageId ) { -- To view, visit https://gerrit.wikimedia.org/r/339588 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I96981c30e0c6c88b2350ff151628517693b05916 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PageAssessments Gerrit-Branch: master Gerrit-Owner: Kaldari <rkald...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits