r98800 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98799‎ | r98800 | r98801 >
Date:20:27, 3 October 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
adding some more fields to the schema
Modified paths:
  • /trunk/extensions/Contest/Contest.i18n.php (modified) (history)
  • /trunk/extensions/Contest/Contest.sql (modified) (history)
  • /trunk/extensions/Contest/includes/Contest.class.php (modified) (history)
  • /trunk/extensions/Contest/includes/ContestContestant.php (modified) (history)
  • /trunk/extensions/Contest/includes/ContestantPager.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/Contest.i18n.php
@@ -134,10 +134,12 @@
135135
136136 // Contestant pager
137137 'contest-contestant-id' => 'ID',
138 - 'contest-contestant-volunteer' => 'Interested in volunteering oportunities',
139 - 'contest-contestant-wmf' => 'Interested in job oportunities',
 138+ 'contest-contestant-volunteer' => 'Volunteer',
 139+ 'contest-contestant-wmf' => 'WMF',
140140 'contest-contestant-no' => 'No',
141141 'contest-contestant-yes' => 'Yes',
 142+ 'contest-contestant-commentcount' => 'Comments',
 143+ 'contest-contestant-overallrating' => 'Rating',
142144 );
143145
144146 /** Message documentation (Message documentation)
Index: trunk/extensions/Contest/includes/ContestantPager.php
@@ -32,6 +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',
3638 );
3739
3840 $headers = array_map( 'wfMsg', $headers );
@@ -40,6 +42,27 @@
4143 return $headers;
4244 }
4345
 46+ function formatRow( $row ) {
 47+ $this->mCurrentRow = $row; # In case formatValue etc need to know
 48+ $s = Xml::openElement( 'tr', $this->getRowAttrs($row) );
 49+
 50+ foreach ( $this->getFieldNames() as $field => $name ) {
 51+ $value = isset( $row->$field ) ? $row->$field : null;
 52+ $formatted = strval( $this->formatValue( $field, $value ) );
 53+
 54+ if ( $formatted == '' ) {
 55+ $formatted = ' ';
 56+ }
 57+ $s .= Xml::tags( 'td', $this->getCellAttrs( $field, $value ), $formatted );
 58+ }
 59+
 60+
 61+
 62+ $s .= "</tr>\n";
 63+
 64+ return $s;
 65+ }
 66+
4467 public function formatValue( $name, $value ) {
4568 switch ( $name ) {
4669 case 'contestant_volunteer': case 'contestant_wmf':
Index: trunk/extensions/Contest/includes/ContestContestant.php
@@ -96,7 +96,11 @@
9797 'volunteer' => 'bool',
9898 'wmf' => 'bool',
9999
100 - 'submission' => 'wtf', // TODO
 100+ 'submission' => 'str',
 101+
 102+ 'rating' => 'int',
 103+ 'rating_count' => 'int',
 104+ 'comments' => 'int',
101105 );
102106 }
103107
@@ -115,7 +119,13 @@
116120
117121 'country' => '',
118122 'volunteer' => false,
119 - 'wmf' => false
 123+ 'wmf' => false,
 124+
 125+ 'submission' => '',
 126+
 127+ 'rating' => 0,
 128+ 'rating_count' => 0,
 129+ 'comments' => 0,
120130 );
121131 }
122132
Index: trunk/extensions/Contest/includes/Contest.class.php
@@ -90,10 +90,14 @@
9191 'id' => 'id',
9292 'name' => 'str',
9393 'status' => 'int',
94 - 'submission_count' => 'int',
 94+ 'end' => 'int',
 95+
9596 'rules_page' => 'str',
9697 'oppertunities' => 'str',
9798 'intro' => 'str',
 99+ 'help' => 'str',
 100+
 101+ 'submission_count' => 'int',
98102 );
99103 }
100104
@@ -108,10 +112,14 @@
109113 return array(
110114 'name' => '',
111115 'status' => self::STATUS_DRAFT,
112 - 'submission_count' => 0,
 116+ 'end' => '',
 117+
113118 'rules_page' => 'MediaWiki:',
114119 'oppertunities' => 'MediaWiki:',
115120 'intro' => 'MediaWiki:',
 121+ 'help' => '',
 122+
 123+ 'submission_count' => 0,
116124 );
117125 }
118126
@@ -346,4 +354,4 @@
347355 return $success;
348356 }
349357
350 -}
\ No newline at end of file
 358+}
Index: trunk/extensions/Contest/Contest.sql
@@ -7,10 +7,14 @@
88 contest_id SMALLINT unsigned NOT NULL auto_increment PRIMARY KEY,
99 contest_name VARCHAR(255) NOT NULL, -- String indentifier for the contest
1010 contest_status TINYINT unsigned NOT NULL default '0', -- Status of the contest
11 - contest_submission_count SMALLINT unsigned NOT NULL, -- Amount of submissions made to the contest
 11+ contest_end varbinary(14) NOT NULL default '', -- End time of the contest
 12+
1213 contest_rules_page VARCHAR(255) NOT NULL, -- Name of the page with rules
1314 contest_oppertunities VARCHAR(255) NOT NULL, -- Name of the page with oppertunities
14 - contest_intro VARCHAR(255) NOT NULL -- Name of the page with the intro text
 15+ contest_intro VARCHAR(255) NOT NULL, -- Name of the page with the intro text
 16+ contest_help VARCHAR(255) NOT NULL, -- Name of the page with contest help
 17+
 18+ contest_submission_count SMALLINT unsigned NOT NULL-- Amount of submissions made to the contest
1519 ) /*$wgDBTableOptions*/;
1620
1721 -- Contestants
@@ -30,13 +34,18 @@
3135 contestant_volunteer TINYINT unsigned NOT NULL, -- If the user is interested in voluneer oportunities
3236 contestant_wmf TINYINT unsigned NOT NULL, -- If the user is interested in a WMF job
3337
34 - contestant_submission TINYBLOB NOT NULL -- URL to the users submission
 38+ contestant_submission TINYBLOB NOT NULL, -- URL to the users submission
 39+
 40+ contestant_rating TINYINT unsigned NOT NULL, -- The avarage rating of the contestant
 41+ contestant_rating_count SMALLINT unsigned NOT NULL, -- The amount of ratings
 42+ contestant_comments SMALLINT unsigned NOT NULL -- The amount of comments
3543 ) /*$wgDBTableOptions*/;
3644
3745 -- Challanges
3846 CREATE TABLE IF NOT EXISTS /*_*/contest_challanges (
3947 challange_id INT unsigned NOT NULL auto_increment PRIMARY KEY, -- Challange id
4048 challange_contest_id INT unsigned NOT NULL,
 49+
4150 challange_text TEXT NOT NULL,
4251 challange_title VARCHAR(255) NOT NULL
4352 ) /*$wgDBTableOptions*/;
@@ -46,6 +55,7 @@
4756 vote_id INT unsigned NOT NULL auto_increment PRIMARY KEY,
4857 vote_contestant_id INT unsigned NOT NULL, -- Foreign key on contest_contestants.contestant_id
4958 vote_user_id INT(10) unsigned NOT NULL, -- Judge user id
 59+
5060 vote_value SMALLINT NOT NULL -- The value of the vote
5161 ) /*$wgDBTableOptions*/;
5262
@@ -54,6 +64,7 @@
5565 comment_id INT unsigned NOT NULL auto_increment PRIMARY KEY,
5666 comment_contestant_id INT unsigned NOT NULL, -- Foreign key on contest_contestants.contestant_id
5767 comment_user_id INT(10) unsigned NOT NULL, -- Judge user id
 68+
5869 comment_text TEXT NOT NULL, -- The comment text
5970 comment_time varbinary(14) NOT NULL default '' -- The time at which the comment was made
6071 ) /*$wgDBTableOptions*/;
\ No newline at end of file

Status & tagging log