Add report with list of reviews that have only one +2 mark
The report returns JSON containing subject of review, project, url, ids of reviewer and patch owner Change-Id: I08dd52c7626a519236a1a9f0541ad533ed63ba4b
This commit is contained in:
parent
55d73db025
commit
1b576555ec
@ -13,6 +13,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import collections
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
import operator
|
import operator
|
||||||
@ -204,3 +205,36 @@ def get_commit_report(records):
|
|||||||
'primary_key', 'change_id']])
|
'primary_key', 'change_id']])
|
||||||
response.append(nr)
|
response.append(nr)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@blueprint.route('/single_plus_two_reviews')
|
||||||
|
@decorators.jsonify()
|
||||||
|
@decorators.exception_handler()
|
||||||
|
@decorators.record_filter(ignore='metric')
|
||||||
|
def get_single_plus_two_reviews_report(records):
|
||||||
|
memory_storage_inst = vault.get_memory_storage()
|
||||||
|
plus_twos = collections.defaultdict(list)
|
||||||
|
for record in records:
|
||||||
|
if record['record_type'] != 'mark':
|
||||||
|
continue
|
||||||
|
|
||||||
|
if (record['branch'] == 'master' and record['type'] == 'CRVW' and
|
||||||
|
record['value'] == +2):
|
||||||
|
review_id = record['review_id']
|
||||||
|
review = memory_storage_inst.get_record_by_primary_key(review_id)
|
||||||
|
if review and review['status'] == 'MERGED':
|
||||||
|
plus_twos[review_id].append(record)
|
||||||
|
|
||||||
|
response = []
|
||||||
|
for review_id in plus_twos.keys():
|
||||||
|
if len(plus_twos[review_id]) < 2:
|
||||||
|
mark = plus_twos[review_id][0]
|
||||||
|
review = memory_storage_inst.get_record_by_primary_key(
|
||||||
|
mark['review_id'])
|
||||||
|
response.append({'review_by': review['user_id'],
|
||||||
|
'mark_by': mark['user_id'],
|
||||||
|
'subject': review['subject'],
|
||||||
|
'url': review['url'],
|
||||||
|
'project': review['project']})
|
||||||
|
|
||||||
|
return response
|
||||||
|
Loading…
x
Reference in New Issue
Block a user