Index: trunk/extensions/Contest/includes/ContestContestant.php |
— | — | @@ -95,6 +95,7 @@ |
96 | 96 | 'country' => 'str', |
97 | 97 | 'volunteer' => 'bool', |
98 | 98 | 'wmf' => 'bool', |
| 99 | + 'cv' => 'str', |
99 | 100 | |
100 | 101 | 'submission' => 'str', |
101 | 102 | |
— | — | @@ -120,6 +121,7 @@ |
121 | 122 | 'country' => '', |
122 | 123 | 'volunteer' => false, |
123 | 124 | 'wmf' => false, |
| 125 | + 'cv' => false, |
124 | 126 | |
125 | 127 | 'submission' => '', |
126 | 128 | |
Index: trunk/extensions/Contest/includes/Contest.class.php |
— | — | @@ -394,8 +394,27 @@ |
395 | 395 | * @return boolean Success indicator |
396 | 396 | */ |
397 | 397 | public function removeAllFromDB() { |
398 | | - // TODO |
399 | | - return parent::removeFromDB(); |
| 398 | + $condition = array( 'contest_id' => $this->getId() ); |
| 399 | + |
| 400 | + $success = ContestChallenge::s()->delete( $condition ); |
| 401 | + |
| 402 | + if ( $success ) { |
| 403 | + $contestantIds = array(); |
| 404 | + |
| 405 | + foreach ( ContestContestant::s()->select( 'id', $condition ) as /* ContestContestant */ $contestant ) { |
| 406 | + $contestantIds[] = $contestant->getId(); |
| 407 | + } |
| 408 | + |
| 409 | + $success = ContestComment::s()->delete( array( 'contestant_id' => $contestantIds ) ) && $success; |
| 410 | + $success = ContestVote::s()->delete( array( 'contestant_id' => $contestantIds ) ) && $success; |
| 411 | + $success = ContestContestant::s()->delete( $condition ) && $success; |
| 412 | + } |
| 413 | + |
| 414 | + if ( $success ) { |
| 415 | + $success = parent::removeFromDB(); |
| 416 | + } |
| 417 | + |
| 418 | + return $success; |
400 | 419 | } |
401 | 420 | |
402 | 421 | /** |
Index: trunk/extensions/Contest/Contest.sql |
— | — | @@ -33,6 +33,7 @@ |
34 | 34 | contestant_country VARCHAR(255) NOT NULL, -- Country code of the contestant |
35 | 35 | contestant_volunteer TINYINT unsigned NOT NULL, -- If the user is interested in voluneer oportunities |
36 | 36 | contestant_wmf TINYINT unsigned NOT NULL, -- If the user is interested in a WMF job |
| 37 | + contestant_cv TINYBLOB NOT NULL, -- URL to the users CV |
37 | 38 | |
38 | 39 | contestant_submission TINYBLOB NOT NULL, -- URL to the users submission |
39 | 40 | |