r98829 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98828‎ | r98829 | r98830 >
Date:23:30, 3 October 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
work on contestants pager
Modified paths:
  • /trunk/extensions/Contest/Contest.i18n.php (modified) (history)
  • /trunk/extensions/Contest/api/ApiDeleteContest.php (modified) (history)
  • /trunk/extensions/Contest/includes/Contest.class.php (modified) (history)
  • /trunk/extensions/Contest/includes/ContestantPager.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/Contest.i18n.php
@@ -141,6 +141,7 @@
142142 'contest-contestant-yes' => 'Yes',
143143 'contest-contestant-commentcount' => 'Comments',
144144 'contest-contestant-overallrating' => 'Rating',
 145+ 'contest-contestant-rating' => '$1 ($2 {{PLURAL:$2|vote|votes}})'
145146 );
146147
147148 /** Message documentation (Message documentation)
Index: trunk/extensions/Contest/includes/ContestantPager.php
@@ -32,8 +32,8 @@
3333 'contestant_id' => 'contest-contestant-id',
3434 'contestant_volunteer' => 'contest-contestant-volunteer',
3535 'contestant_wmf' => 'contest-contestant-wmf',
36 - 'contestant_comment_count' => 'contest-contestant-commentcount',
37 - 'contestant_overall_rating' => 'contest-contestant-overallrating',
 36+ 'contestant_comments' => 'contest-contestant-commentcount',
 37+ 'contestant_rating' => 'contest-contestant-overallrating',
3838 );
3939
4040 $headers = array_map( 'wfMsg', $headers );
@@ -68,6 +68,17 @@
6969 case 'contestant_volunteer': case 'contestant_wmf':
7070 $value = wfMsg( 'contest-contestant-' . ( $value === '1' ? 'yes' : 'no' ) );
7171 break;
 72+ case 'contestant_comments':
 73+ $value = $this->getLang()->formatNum( $value );
 74+ break;
 75+ case 'contestant_rating':
 76+ $value = wfMsgExt(
 77+ 'contest-contestant-rating',
 78+ 'parsemag',
 79+ $this->getLang()->formatNum( $value ),
 80+ $this->getLang()->formatNum( $this->mCurrentRow->contestant_rating_count )
 81+ );
 82+ break;
7283 }
7384
7485 return $value;
@@ -80,6 +91,9 @@
8192 'contestant_id',
8293 'contestant_volunteer',
8394 'contestant_wmf',
 95+ 'contestant_comments',
 96+ 'contestant_rating',
 97+ 'contestant_rating_count',
8498 ),
8599 'conds' => $this->conds,
86100 );
@@ -105,7 +119,9 @@
106120 array(
107121 'contestant_id',
108122 'contestant_volunteer',
109 - 'contestant_wmf'
 123+ 'contestant_wmf',
 124+ 'contestant_comments',
 125+ 'contestant_rating',
110126 )
111127 );
112128 }
Index: trunk/extensions/Contest/includes/Contest.class.php
@@ -387,6 +387,18 @@
388388 }
389389
390390 /**
 391+ * Remove the contest and all it's linked data from the database.
 392+ *
 393+ * @since 0.1
 394+ *
 395+ * @return boolean Success indicator
 396+ */
 397+ public function removeAllFromDB() {
 398+ // TODO
 399+ return parent::removeFromDB();
 400+ }
 401+
 402+ /**
391403 * Do all actions that need to be done on contest finish.
392404 *
393405 * @since 0.1
Index: trunk/extensions/Contest/api/ApiDeleteContest.php
@@ -30,7 +30,8 @@
3131 $everythingOk = true;
3232
3333 foreach ( $params['ids'] as $id ) {
34 - $everythingOk = Contest::s()->delete( array( 'id' => $id ) ) && $everythingOk;
 34+ $contest = new Contest( array( 'id' => $id ) );
 35+ $everythingOk = $contest->removeAllFromDB() && $everythingOk;
3536 }
3637
3738 $this->getResult()->addValue(

Status & tagging log