Skip to content
This repository was archived by the owner on Dec 11, 2018. It is now read-only.

Commit beea918

Browse files
committed
Make reviews.recommendation complicated
The committee has asked for the recommendation field to change from a yes/no boolean to a quad-state selection: * Yes * Yes with changes * Neutral * No
1 parent 3e04e81 commit beea918

File tree

9 files changed

+57
-5
lines changed

9 files changed

+57
-5
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- Change recommendation from 0=no,1=yes
2+
-- to: -2=no,2=yes,0=neutral,-1=yes with changes
3+
-- Roughly based on gerrit review scale
4+
5+
UPDATE reviews
6+
SET recommendation = -2
7+
WHERE recommendation = 0;
8+
9+
UPDATE reviews
10+
SET recommendation = 2
11+
WHERE recommendation = 1;

data/i18n/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@
142142
"review-edit-save-error": "Failed to save changes.",
143143

144144
"form-yes": "Yes",
145+
"form-conditional": "Yes, with changes",
146+
"form-neutral": "Neutral",
145147
"form-no": "No",
146148

147149
"proposals-search-title": "Title",
@@ -177,7 +179,7 @@
177179
"report-aggregated-ability": "Ability",
178180
"report-aggregated-engagement": "Engagement",
179181
"report-aggregated-recommend": "Recommend",
180-
"report-format-recommend": "$3% ($1/$2)",
182+
"report-format-recommend": "$4% ($1/$3)$2",
181183

182184
"reviews-notes": "Reviewer notes",
183185

data/i18n/qqq.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@
118118
"review-edit-save-error": "Failure message.",
119119

120120
"form-yes": "Radio button label.",
121+
"form-conditional": "Radio button label.",
122+
"form-neutral": "Radio button label.",
121123
"form-no": "Radio button label.",
122124

123125
"proposals-search-title": "Input label, followed by text box.",
@@ -148,5 +150,15 @@
148150
"proposals-queue-type-all": "Select list label",
149151
"proposals-queue-theme": "Input label, followed by select list.",
150152
"proposals-queue-theme-empty": "Select list usage prompt.",
151-
"proposals-queue-go": "Form submit button label"
153+
"proposals-queue-go": "Form submit button label",
154+
155+
"report-aggregated-proposal": "Report column header",
156+
"report-aggregated-theme": "Report column header",
157+
"report-aggregated-amount": "Report column header",
158+
"report-aggregated-impact": "Report column header",
159+
"report-aggregated-innovation": "Report column header",
160+
"report-aggregated-ability": "Report column header",
161+
"report-aggregated-engagement": "Report column header",
162+
"report-aggregated-recommend": "Report column header",
163+
"report-format-recommend": "Report column value.\n\n* $1 - Number of reviewers recommending proposal\n* $2 - \"*\" if some recommendations were conditional\n* $3 - Total number of reviews\n* $4 - Percentage of reviews recomending approval."
152164
}

data/templates/inc/forms.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,21 @@
103103
{{ forms.endElement( ctx, name, mesg ) }}
104104
{% endmacro %}
105105

106+
{% macro radioList( ctx, mesg, name, options, opts = {} ) %}
107+
{% import _self as forms %}
108+
{% set value = opts.value ?: ctx.form.get( name ) %}
109+
{{ forms.startElement( ctx, mesg, '', opts ) }}
110+
<div class="form-inline">
111+
{% for val,label in options %}
112+
<label class="control-label">
113+
<input type="radio" id="{{ name }}-{{ val }}" name="{{ name }}" value="{{ val }}" {{ value == val ? 'checked="checked"' }}/>
114+
{{ label|message }}
115+
</label>&nbsp;
116+
{% endfor %}
117+
</div>
118+
{{ forms.endElement( ctx, name, mesg ) }}
119+
{% endmacro %}
120+
106121
{% macro checkboxList( ctx, mesg, options, opts = {} ) %}
107122
{% import _self as forms %}
108123
{{ forms.startElement( ctx, mesg, '', opts ) }}

data/templates/proposals/view_review_edit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ <h4 class="panel-title">{{ 'review-recommendation'|message }}</h4>
5353
<div class="panel-body">
5454
{{ 'review-recommendation-instructions'|message|markdown }}
5555
<div class="form-group">
56-
{{ forms.yesNo( ctx, 'review-recommendation-rank', 'recommendation', { 'required':true, 'value':myreview.recommendation } ) }}
56+
{{ forms.radioList( ctx, 'review-recommendation-rank', 'recommendation', { '2':'form-yes', '1':'form-conditional', '0':'form-neutral', '-1':'form-no' }, { 'required':true, 'value':myreview.recommendation } ) }}
5757
</div>
5858
<div class="form-group">
5959
<label for="comments" class="control-label">{{ 'review-recommendation-note'|message }}</label>

data/templates/proposals/view_reviews.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,17 @@ <h3 class="panel-title">{{ 'review-recommendation'|message }}
111111
<thead>
112112
<tr>
113113
<th>{{ 'form-yes'|message }}</th>
114+
<th>{{ 'form-conditional'|message }}</th>
115+
<th>{{ 'form-neutral'|message }}</th>
114116
<th>{{ 'form-no'|message }}</th>
115117
</tr>
116118
</thead>
117119
<tbody>
118120
<tr>
121+
<td>{{ helpers.count( reviews, 'recommendation', 2 ) }}</td>
119122
<td>{{ helpers.count( reviews, 'recommendation', 1 ) }}</td>
120123
<td>{{ helpers.count( reviews, 'recommendation', 0 ) }}</td>
124+
<td>{{ helpers.count( reviews, 'recommendation', -1 ) }}</td>
121125
</tr>
122126
</tbody>
123127
</table>

src/Controllers/Reports/Aggregated.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ protected function describeColumns() {
8888
'report-aggregated-recommend' => array(
8989
'format' => 'message',
9090
'message' => 'report-format-recommend',
91-
'columns' => array( 'recommend', 'rcnt', 'pcnt' ),
91+
'columns' => array(
92+
'recommend', 'conditional', 'rcnt', 'pcnt',
93+
),
9294
'sortable' => true,
9395
'sortcolumn' => 'pcnt',
9496
),

src/Dao/AbstractDao.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ protected function fetchAll( $sql, $params = null ) {
150150
* Prepare and execute an SQL statement and return all results plus the
151151
* number of rows found on the server side.
152152
*
153+
* The SQL is expected to contain the "SQL_CALC_FOUND_ROWS" option in the
154+
* select statement. If it does not, the number of found rows returned is
155+
* dependent on MySQL's interpretation of the query.
156+
*
153157
* @param string $sql SQL
154158
* @param array $params Prepared statement parameters
155159
* @return object StdClass with rows and found memebers

src/Dao/Reports.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public function aggregatedScores( array $params ) {
9191
'r.ability,',
9292
'r.engagement,',
9393
'r.recommend,',
94+
'IF(r.conditional >0, \'*\', \'\') AS conditional,',
9495
'r.cnt AS rcnt,',
9596
'ROUND((r.recommend / r.cnt) * 100, 2) AS pcnt',
9697
'FROM proposals p',
@@ -100,7 +101,8 @@ public function aggregatedScores( array $params ) {
100101
'AVG(innovation) AS innovation,',
101102
'AVG(ability) AS ability,',
102103
'AVG(engagement) AS engagement,',
103-
'SUM(recommendation) AS recommend,',
104+
'SUM(IF(recommendation > 0, 1, 0)) AS recommend,',
105+
'SUM(IF(recommendation = 1, 1, 0)) AS conditional,',
104106
'proposal',
105107
'FROM reviews',
106108
'GROUP BY proposal',

0 commit comments

Comments
 (0)