jenkins-bot has submitted this change and it was merged.
Change subject: Show only phase 1 passing applications in language report
......................................................................
Show only phase 1 passing applications in language report
Bug: T85017
Change-Id: I179812c55e4e6aa1164be9fd1c04ecf77ee09c17
---
M data/i18n/en.json
M data/i18n/qqq.json
M data/templates/review/communities.html
M data/templates/review/search.html
M src/Wikimania/Scholarship/Controllers/Review/Search.php
M src/Wikimania/Scholarship/Dao/Apply.php
6 files changed, 50 insertions(+), 18 deletions(-)
Approvals:
BryanDavis: Looks good to me, approved
jenkins-bot: Verified
diff --git a/data/i18n/en.json b/data/i18n/en.json
index b3046c9..617010d 100644
--- a/data/i18n/en.json
+++ b/data/i18n/en.json
@@ -306,6 +306,7 @@
"search-region": "Geographic region:",
"search-community-size": "Community size:",
"search-globalns": "Global North/South:",
+ "search-phase1": "Passed Phase 1 review",
"admin-settings-phase1pass": "Phase 1 pass score:",
"admin-settings-phase2pass": "Phase 2 pass score:",
diff --git a/data/i18n/qqq.json b/data/i18n/qqq.json
index 88617ea..edf7b36 100644
--- a/data/i18n/qqq.json
+++ b/data/i18n/qqq.json
@@ -271,6 +271,7 @@
"search-region": "Input label, followed by text box",
"search-community-size": "Input label, followed by text box",
"search-globalns": "Input label, followed by text box",
+ "search-phase1": "Input label, preceeded by checkbox",
"settings-pass-scores": "Settings page section label, section contains
input boxes for setting pass scores",
"settings-weighing-factors": "Settings page section label, section
contains input boxes for setting application weighing factors",
"settings-app-period": "Settings page section label, section contains
input boxes for setting application period open and close dates",
diff --git a/data/templates/review/communities.html
b/data/templates/review/communities.html
index e86ea91..518aa64 100644
--- a/data/templates/review/communities.html
+++ b/data/templates/review/communities.html
@@ -15,8 +15,8 @@
</tr>
{% for row in records %}
<tr>
- <td><a href="{{ urlFor( 'review_search' ) }}?cs={{ row.size|url_encode
}}&ns={{ row.globalns }}">{{ row.size }}</a></td>
- <td><a href="{{ urlFor( 'review_search' ) }}?cs={{ row.size|url_encode
}}&ns={{ row.globalns }}">{{ row.globalns }}</a></td>
+ <td><a href="{{ urlFor( 'review_search' ) }}?cs={{ row.size|url_encode
}}&ns={{ row.globalns }}&p1=1">{{ row.size }}</a></td>
+ <td><a href="{{ urlFor( 'review_search' ) }}?cs={{ row.size|url_encode
}}&ns={{ row.globalns }}&p1=1">{{ row.globalns }}</a></td>
<td>{{ row.sid }}</td>
</tr>
{% endfor %}
diff --git a/data/templates/review/search.html
b/data/templates/review/search.html
index 595ff8f..8b7bb6d 100644
--- a/data/templates/review/search.html
+++ b/data/templates/review/search.html
@@ -42,6 +42,13 @@
</div>
<div class="form-group">
+ <label class="control-label">
+ <input type="checkbox" id="p1" name="p1" value="1" {{ p1 == 1 ?
'checked="checked"' }}/>
+ {{ wgLang.message( 'search-phase1' ) }}
+ </label>
+ </div>
+
+ <div class="form-group">
<input type="submit" class="btn btn-sm btn-primary" value="{{
wgLang.message( 'search' ) }}" />
</div>
diff --git a/src/Wikimania/Scholarship/Controllers/Review/Search.php
b/src/Wikimania/Scholarship/Controllers/Review/Search.php
index e5c758f..7eddb1a 100644
--- a/src/Wikimania/Scholarship/Controllers/Review/Search.php
+++ b/src/Wikimania/Scholarship/Controllers/Review/Search.php
@@ -39,6 +39,7 @@
$this->form->expectString( 'rg' );
$this->form->expectString( 'cs' );
$this->form->expectString( 'ns' );
+ $this->form->expectBool( 'p1' );
$this->form->expectInt( 'items',
array( 'min_range' => 1, 'max_range' => 250, 'default'
=> 50 )
);
@@ -51,13 +52,15 @@
$this->view->set( 'rg', $this->form->get( 'rg' ) );
$this->view->set( 'cs', $this->form->get( 'cs' ) );
$this->view->set( 'ns', $this->form->get( 'ns' ) );
+ $this->view->set( 'p1', $this->form->get( 'p1' ) );
$this->view->set( 'items', $this->form->get( 'items' ) );
$this->view->set( 'p', $this->form->get( 'p' ) );
$this->view->set( 'found', null );
if ( $this->form->get( 'l' ) || $this->form->get( 'f' ) ||
$this->form->get( 'r' ) || $this->form->get( 'rg' ) ||
- $this->form->get( 'cs' ) || $this->form->get( 'ns' )
+ $this->form->get( 'cs' ) || $this->form->get( 'ns' ) ||
+ $this->form->get( 'p1' )
) {
$params = array(
@@ -69,6 +72,7 @@
'globalns' =>$this->form->get( 'ns' ),
'items' => $this->form->get( 'items' ),
'page' => $this->form->get( 'p' ),
+ 'phase1' => $this->form->get( 'p1' ),
);
$ret = $this->dao->search( $params );
diff --git a/src/Wikimania/Scholarship/Dao/Apply.php
b/src/Wikimania/Scholarship/Dao/Apply.php
index 6047cdd..f7b51cb 100644
--- a/src/Wikimania/Scholarship/Dao/Apply.php
+++ b/src/Wikimania/Scholarship/Dao/Apply.php
@@ -272,6 +272,7 @@
'globalns' => null,
'items' => 50,
'page' => 0,
+ 'phase1' => false,
);
$params = array_merge( $defaults, $params );
@@ -310,6 +311,10 @@
$where[] = "c.globalns = :globalns";
$crit['globalns'] = $params['globalns'];
}
+ if ( $params['phase1'] ) {
+ $where[] = 'p1score >= :int_phase1pass';
+ $crit['int_phase1pass'] =
(int)$this->settings['phase1pass'];
+ }
$where[] = "s.exclude = 0";
@@ -342,19 +347,19 @@
"GROUP BY scholarship_id"
);
- $sql = self::concat(
- "SELECT SQL_CALC_FOUND_ROWS", implode( ',',
$fields ),
- "FROM scholarships s",
- "LEFT OUTER JOIN ( {$p1scoreSql} ) r1 ON s.id =
r1.scholarship_id",
- "LEFT OUTER JOIN ( {$p1countSql} ) r2 ON s.id =
r2.scholarship_id",
- "LEFT OUTER JOIN ( {$mycountSql} ) r3 ON s.id =
r3.scholarship_id",
- "LEFT OUTER JOIN iso_countries c ON s.residence
= c.code",
- "LEFT OUTER JOIN language_communities l ON
s.community = l.code",
- self::buildWhere( $where ),
- "ORDER BY s.id",
- $limit,
- $offset
- );
+ $sql = self::concat(
+ "SELECT SQL_CALC_FOUND_ROWS", implode( ',', $fields ),
+ "FROM scholarships s",
+ "LEFT OUTER JOIN ( {$p1scoreSql} ) r1 ON s.id =
r1.scholarship_id",
+ "LEFT OUTER JOIN ( {$p1countSql} ) r2 ON s.id =
r2.scholarship_id",
+ "LEFT OUTER JOIN ( {$mycountSql} ) r3 ON s.id =
r3.scholarship_id",
+ "LEFT OUTER JOIN iso_countries c ON s.residence =
c.code",
+ "LEFT OUTER JOIN language_communities l ON s.community
= l.code",
+ self::buildWhere( $where ),
+ "ORDER BY s.id",
+ $limit,
+ $offset
+ );
return $this->fetchAllWithFound( $sql, $crit );
}
@@ -641,12 +646,26 @@
* Multilingual community - Global South
*/
public function getListOfCommunities() {
+
+ $p1scoreSql = $this->makeAggregateRankSql( 'valid', 'SUM',
'p1score' );
+
+ $fields = array(
+ 'count(*) as sid',
+ 'l.size',
+ 'c.globalns',
+ 'COALESCE(p1score, 0) as p1score',
+ );
+
return $this->fetchAll( self::concat(
- "SELECT count(*) as sid, l.size, c.globalns",
+ "SELECT", implode( ',', $fields ),
"FROM scholarships s",
+ "LEFT JOIN ({$p1scoreSql}) r2 ON s.id =
r2.scholarship_id",
"LEFT JOIN language_communities l ON l.code =
s.community",
"LEFT JOIN iso_countries c ON c.code = s.residence",
- "GROUP BY l.size"
+ "WHERE p1score >= :int_phase1pass AND s.exclude = 0",
+ "GROUP BY l.size, c.globalns"
+ ), array(
+ 'int_phase1pass' => (int)$this->settings['phase1pass'],
) );
}
--
To view, visit https://gerrit.wikimedia.org/r/183253
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I179812c55e4e6aa1164be9fd1c04ecf77ee09c17
Gerrit-PatchSet: 5
Gerrit-Project: wikimedia/wikimania-scholarships
Gerrit-Branch: master
Gerrit-Owner: Niharika29 <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Niharika29 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits