BryanDavis has uploaded a new change for review. https://gerrit.wikimedia.org/r/99536
Change subject: Check for missing application ...................................................................... Check for missing application This is a "duh" bug. The code was blindly assuming that a database record was found in all cases. Bug: 58046 Change-Id: I7c8d1d39cddc3a4b6b5c6e7a10fb7482216c2344 --- M data/templates/review/view.html M src/Wikimania/Scholarship/Controllers/Review/Application.php 2 files changed, 26 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/wikimania-scholarships refs/changes/36/99536/1 diff --git a/data/templates/review/view.html b/data/templates/review/view.html index e69fd1a..a6804c0 100644 --- a/data/templates/review/view.html +++ b/data/templates/review/view.html @@ -4,6 +4,9 @@ {% block content %} {% spaceless %} +{% if schol == false %} +<p>Application not found.</p> +{% else %} <form method="post" action="{{ urlFor( 'review_view_post' ) }}"> <input type="hidden" name="phase" value="{{ phase }}"/> <input type="hidden" name="id" value="{{ id }}"/> @@ -240,5 +243,6 @@ <dt>{{ k }}</dt><dd>{{ v }}</dd> {% endfor %} </dl> +{% endif %} {% endspaceless %} {% endblock content %} diff --git a/src/Wikimania/Scholarship/Controllers/Review/Application.php b/src/Wikimania/Scholarship/Controllers/Review/Application.php index 923bb51..7d9b300 100644 --- a/src/Wikimania/Scholarship/Controllers/Review/Application.php +++ b/src/Wikimania/Scholarship/Controllers/Review/Application.php @@ -41,22 +41,33 @@ $userId = $this->authManager->getuserId(); $id = $this->request->get( 'id' ); - if ( $id === null || $id < 0 ) { - $unreviewed = $this->dao->myUnreviewed( $phase ); - $id = min( $unreviewed ); - } - if ( $id == '' or $id < 0 ) { - $this->flashNow( 'error', "Plase click Phase {$phase} to return to the list" ); + if ( $id === null || $id < 0 ) { + // Attempt to find first unreviewed application for the current user + $unreviewed = $this->dao->myUnreviewed( $phase ); + if ( $unreviewed ) { + $id = min( $unreviewed ); + } } $this->view->set( 'phase', $phase ); $this->view->set( 'id', $id ); - $this->view->set( 'myscorings', $this->dao->myRankings( $id, $phase ) ); - $this->view->set( 'reviewers', $this->dao->getReviewers( $id, $phase ) ); - $this->view->set( 'nextid', $this->dao->nextApp( $id, $phase ) ); - $this->view->set( 'previd', $this->dao->prevApp( $id, $phase ) ); - $this->view->set( 'schol', $this->dao->getScholarship( $id ) ); + + $schol = false; + if ( $id !== '' && $id >= 0 ) { + $schol = $this->dao->getScholarship( $id ); + } + $this->view->set( 'schol', $schol ); + + if ( $schol === false ) { + $this->flashNow( 'error', 'Application not found' ); + + } else { + $this->view->set( 'myscorings', $this->dao->myRankings( $id, $phase ) ); + $this->view->set( 'reviewers', $this->dao->getReviewers( $id, $phase ) ); + $this->view->set( 'nextid', $this->dao->nextApp( $id, $phase ) ); + $this->view->set( 'previd', $this->dao->prevApp( $id, $phase ) ); + } $this->render( 'review/view.html' ); } -- To view, visit https://gerrit.wikimedia.org/r/99536 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7c8d1d39cddc3a4b6b5c6e7a10fb7482216c2344 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/wikimania-scholarships Gerrit-Branch: master Gerrit-Owner: BryanDavis <bda...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits