From f327b49033951f3544bec29d401f89b85766ea7a Mon Sep 17 00:00:00 2001 From: Ilya Shakhat Date: Fri, 30 May 2014 15:06:17 +0400 Subject: [PATCH] Changed types of reviews according to Gerrit 2.8 In Gerrit 2.8 type of marks are changed, CRVW became Code-Review, APRV turned into Workflow with value +1. Previously Stackalytics handled this by mapping from new types to old, but this doesn't support case of approval marks. Closes bug 1324080 Change-Id: I7de747b8df5722b840eea0f42b67665058a7ad03 --- dashboard/decorators.py | 2 +- dashboard/helpers.py | 2 +- dashboard/reports.py | 4 +- dashboard/templates/_macros/activity_log.html | 10 +- etc/corrections.json | 176 +++++++++--------- stackalytics/processor/record_processor.py | 14 +- tests/api/test_api.py | 4 +- tests/api/test_stats.py | 2 +- tests/unit/test_record_processor.py | 16 +- 9 files changed, 117 insertions(+), 113 deletions(-) diff --git a/dashboard/decorators.py b/dashboard/decorators.py index 87244a6f4..1edf670c4 100644 --- a/dashboard/decorators.py +++ b/dashboard/decorators.py @@ -204,7 +204,7 @@ def loc_filter(result, record, param_id): def mark_filter(result, record, param_id): result_by_param = result[record[param_id]] - if record['type'] == 'APRV': + if record['type'] == 'Workflow' and record['value'] == 1: value = 'A' else: value = record['value'] diff --git a/dashboard/helpers.py b/dashboard/helpers.py index ec1b23e9c..114a0ef7a 100644 --- a/dashboard/helpers.py +++ b/dashboard/helpers.py @@ -143,7 +143,7 @@ def get_contribution_summary(records): commit_count += 1 loc += record['loc'] elif record['record_type'] == 'mark': - if record['type'] == 'APRV': + if record['type'] == 'Workflow' and record['value'] == 1: marks['A'] += 1 else: marks[record['value']] += 1 diff --git a/dashboard/reports.py b/dashboard/reports.py index 9034d9a40..b97590388 100644 --- a/dashboard/reports.py +++ b/dashboard/reports.py @@ -252,8 +252,8 @@ def get_single_plus_two_reviews_report(records, **kwargs): if record['record_type'] != 'mark': continue - if (record['branch'] == 'master' and record['type'] == 'CRVW' and - record['value'] == +2): + if (record['branch'] == 'master' and + record['type'] == 'Code-Review' 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': diff --git a/dashboard/templates/_macros/activity_log.html b/dashboard/templates/_macros/activity_log.html index b6b4a445b..dd406884f 100644 --- a/dashboard/templates/_macros/activity_log.html +++ b/dashboard/templates/_macros/activity_log.html @@ -97,7 +97,15 @@ show_record_type=True, show_user_gravatar=True, gravatar_size=32, show_all=True)
Review “${parent_subject}”
Submitted by: {%html parent_author_link %} ({%html parent_company_link %}) (#${parent_review_number})
Change Id: ${review_id}
-
${description}: ${value}
+
+ {%if (type == "Workflow" && value == 1) %} + Approved + {%elif (type == "Workflow" && value == -1) %} + Work in progress + {%else%} + ${type}: ${value} + {%/if%} +
{%elif record_type == "review" %}
New change request “${subject}”
Current Status: ${status}
diff --git a/etc/corrections.json b/etc/corrections.json index 6ad07fdcb..d4bebba0c 100644 --- a/etc/corrections.json +++ b/etc/corrections.json @@ -1739,7 +1739,7 @@ { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I8c325770b11ed3c9257599c6fe0d734f0bbfb9ea1396521587CRVW", + "primary_key": "I8c325770b11ed3c9257599c6fe0d734f0bbfb9ea1396521587Code-Review", "company_name": "Symantec" }, { @@ -1751,445 +1751,445 @@ { "author_email": "alexei_vinogradov@symantec.com", "correction_comment": "", - "primary_key": "I8bcce82c92f9de2aebae33c5cbf024f7745dd0bd1396367639CRVW", + "primary_key": "I8bcce82c92f9de2aebae33c5cbf024f7745dd0bd1396367639Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "Ifda2f9a9e315d08c944732a4aa4bcc59cb3ca5831396365207CRVW", + "primary_key": "Ifda2f9a9e315d08c944732a4aa4bcc59cb3ca5831396365207Code-Review", "company_name": "Symantec" }, { "author_email": "achuprin@symantec.com", "correction_comment": "", - "primary_key": "I8bcce82c92f9de2aebae33c5cbf024f7745dd0bd1396358242CRVW", + "primary_key": "I8bcce82c92f9de2aebae33c5cbf024f7745dd0bd1396358242Code-Review", "company_name": "Symantec" }, { "author_email": "alexei_vinogradov@symantec.com", "correction_comment": "", - "primary_key": "I8bcce82c92f9de2aebae33c5cbf024f7745dd0bd1396357218CRVW", + "primary_key": "I8bcce82c92f9de2aebae33c5cbf024f7745dd0bd1396357218Code-Review", "company_name": "Symantec" }, { "author_email": "achuprin@symantec.com", "correction_comment": "", - "primary_key": "I3c8b9940dd32e7ec5947f39b6ce0439dee2c45181396334921CRVW", + "primary_key": "I3c8b9940dd32e7ec5947f39b6ce0439dee2c45181396334921Code-Review", "company_name": "Symantec" }, { "author_email": "alexei_vinogradov@symantec.com", "correction_comment": "", - "primary_key": "I3c8b9940dd32e7ec5947f39b6ce0439dee2c45181396283729CRVW", + "primary_key": "I3c8b9940dd32e7ec5947f39b6ce0439dee2c45181396283729Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "Ifda2f9a9e315d08c944732a4aa4bcc59cb3ca5831396275201CRVW", + "primary_key": "Ifda2f9a9e315d08c944732a4aa4bcc59cb3ca5831396275201Code-Review", "company_name": "Symantec" }, { "author_email": "achuprin@symantec.com", "correction_comment": "", - "primary_key": "I83620ae2ed0d63ce9cbc81db9423bc5e538125e01396250954CRVW", + "primary_key": "I83620ae2ed0d63ce9cbc81db9423bc5e538125e01396250954Code-Review", "company_name": "Symantec" }, { "author_email": "achuprin@symantec.com", "correction_comment": "", - "primary_key": "I83620ae2ed0d63ce9cbc81db9423bc5e538125e01396210928CRVW", + "primary_key": "I83620ae2ed0d63ce9cbc81db9423bc5e538125e01396210928Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "If74c1321e44e29650f9384ef4d46e1737c4fbe221396016546CRVW", + "primary_key": "If74c1321e44e29650f9384ef4d46e1737c4fbe221396016546Code-Review", "company_name": "Symantec" }, { "author_email": "andrey_ostapenko@symantec.com", "correction_comment": "", - "primary_key": "I6a7812d4b36c2e9c70d6d1b87fe014f72ce9d0ab1396005930CRVW", + "primary_key": "I6a7812d4b36c2e9c70d6d1b87fe014f72ce9d0ab1396005930Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_minakov@symantec.com", "correction_comment": "", - "primary_key": "I6a7812d4b36c2e9c70d6d1b87fe014f72ce9d0ab1396003876CRVW", + "primary_key": "I6a7812d4b36c2e9c70d6d1b87fe014f72ce9d0ab1396003876Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_minakov@symantec.com", "correction_comment": "", - "primary_key": "I1628b23677713330ba665d124f98b228f36d9a0f1395951743CRVW", + "primary_key": "I1628b23677713330ba665d124f98b228f36d9a0f1395951743Code-Review", "company_name": "Symantec" }, { "author_email": "achuprin@symantec.com", "correction_comment": "", - "primary_key": "I1628b23677713330ba665d124f98b228f36d9a0f1395946984CRVW", + "primary_key": "I1628b23677713330ba665d124f98b228f36d9a0f1395946984Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_minakov@symantec.com", "correction_comment": "", - "primary_key": "I6a7812d4b36c2e9c70d6d1b87fe014f72ce9d0ab1395946835CRVW", + "primary_key": "I6a7812d4b36c2e9c70d6d1b87fe014f72ce9d0ab1395946835Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "If74c1321e44e29650f9384ef4d46e1737c4fbe221395944886CRVW", + "primary_key": "If74c1321e44e29650f9384ef4d46e1737c4fbe221395944886Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_chudnovets@symantec.com", "correction_comment": "", - "primary_key": "Iadb264d3923c5834daadbe4be72fd4524cbb80cb1395944013CRVW", + "primary_key": "Iadb264d3923c5834daadbe4be72fd4524cbb80cb1395944013Code-Review", "company_name": "Symantec" }, { "author_email": "achuprin@symantec.com", "correction_comment": "", - "primary_key": "I1628b23677713330ba665d124f98b228f36d9a0f1395936097CRVW", + "primary_key": "I1628b23677713330ba665d124f98b228f36d9a0f1395936097Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_chudnovets@symantec.com", "correction_comment": "", - "primary_key": "Iadb264d3923c5834daadbe4be72fd4524cbb80cb1395935668CRVW", + "primary_key": "Iadb264d3923c5834daadbe4be72fd4524cbb80cb1395935668Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_minakov@symantec.com", "correction_comment": "", - "primary_key": "I6e3636ffc4f6505e206b2c319185f2a67fdd73f71395926647CRVW", + "primary_key": "I6e3636ffc4f6505e206b2c319185f2a67fdd73f71395926647Code-Review", "company_name": "Symantec" }, { "author_email": "achuprin@symantec.com", "correction_comment": "", - "primary_key": "Id02bc8ba5a2652ab3bc9c71e4e9cdb13a7dfc2871395920112CRVW", + "primary_key": "Id02bc8ba5a2652ab3bc9c71e4e9cdb13a7dfc2871395920112Code-Review", "company_name": "Symantec" }, { "author_email": "achuprin@symantec.com", "correction_comment": "", - "primary_key": "Ic8c96748144c05ee4e1fb4ce4feade12d2b6da9b1395859563CRVW", + "primary_key": "Ic8c96748144c05ee4e1fb4ce4feade12d2b6da9b1395859563Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_minakov@symantec.com", "correction_comment": "", - "primary_key": "Ic8c96748144c05ee4e1fb4ce4feade12d2b6da9b1395858656CRVW", + "primary_key": "Ic8c96748144c05ee4e1fb4ce4feade12d2b6da9b1395858656Code-Review", "company_name": "Symantec" }, { "author_email": "alexei_vinogradov@symantec.com", "correction_comment": "", - "primary_key": "If280b3380e8defa32425aa033a5fe6dc0d7585391395850851CRVW", + "primary_key": "If280b3380e8defa32425aa033a5fe6dc0d7585391395850851Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "Ic8c96748144c05ee4e1fb4ce4feade12d2b6da9b1395850504CRVW", + "primary_key": "Ic8c96748144c05ee4e1fb4ce4feade12d2b6da9b1395850504Code-Review", "company_name": "Symantec" }, { "author_email": "alexei_vinogradov@symantec.com", "correction_comment": "", - "primary_key": "Ic8c96748144c05ee4e1fb4ce4feade12d2b6da9b1395848925CRVW", + "primary_key": "Ic8c96748144c05ee4e1fb4ce4feade12d2b6da9b1395848925Code-Review", "company_name": "Symantec" }, { "author_email": "alexei_vinogradov@symantec.com", "correction_comment": "", - "primary_key": "Ic8c96748144c05ee4e1fb4ce4feade12d2b6da9b1395842632CRVW", + "primary_key": "Ic8c96748144c05ee4e1fb4ce4feade12d2b6da9b1395842632Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "If280b3380e8defa32425aa033a5fe6dc0d7585391395835874CRVW", + "primary_key": "If280b3380e8defa32425aa033a5fe6dc0d7585391395835874Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I1bd5566395b00413593192f90bf2e756af01df261395831091CRVW", + "primary_key": "I1bd5566395b00413593192f90bf2e756af01df261395831091Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "Ic8c96748144c05ee4e1fb4ce4feade12d2b6da9b1395830850CRVW", + "primary_key": "Ic8c96748144c05ee4e1fb4ce4feade12d2b6da9b1395830850Code-Review", "company_name": "Symantec" }, { "author_email": "achuprin@symantec.com", "correction_comment": "", - "primary_key": "Ifc20bd3b8b0310b94077c3559d4970b156ed09cb1395824464CRVW", + "primary_key": "Ifc20bd3b8b0310b94077c3559d4970b156ed09cb1395824464Code-Review", "company_name": "Symantec" }, { "author_email": "achuprin@symantec.com", "correction_comment": "", - "primary_key": "Ic8c96748144c05ee4e1fb4ce4feade12d2b6da9b1395819564CRVW", + "primary_key": "Ic8c96748144c05ee4e1fb4ce4feade12d2b6da9b1395819564Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I3e9f8a43a3212f7f821cf9d06b65d17625981b6f1395758455CRVW", + "primary_key": "I3e9f8a43a3212f7f821cf9d06b65d17625981b6f1395758455Code-Review", "company_name": "Symantec" }, { "author_email": "achuprin@symantec.com", "correction_comment": "", - "primary_key": "I3e9f8a43a3212f7f821cf9d06b65d17625981b6f1395756702CRVW", + "primary_key": "I3e9f8a43a3212f7f821cf9d06b65d17625981b6f1395756702Code-Review", "company_name": "Symantec" }, { "author_email": "alexei_vinogradov@symantec.com", "correction_comment": "", - "primary_key": "I3e9f8a43a3212f7f821cf9d06b65d17625981b6f1395756647CRVW", + "primary_key": "I3e9f8a43a3212f7f821cf9d06b65d17625981b6f1395756647Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I3e9f8a43a3212f7f821cf9d06b65d17625981b6f1395750271CRVW", + "primary_key": "I3e9f8a43a3212f7f821cf9d06b65d17625981b6f1395750271Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I642382b3d4bc91b94336ff5c19c175ef242b4f111395745101CRVW", + "primary_key": "I642382b3d4bc91b94336ff5c19c175ef242b4f111395745101Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I1bd5566395b00413593192f90bf2e756af01df261395744582CRVW", + "primary_key": "I1bd5566395b00413593192f90bf2e756af01df261395744582Code-Review", "company_name": "Symantec" }, { "author_email": "ipekelny@symantec.com", "correction_comment": "", - "primary_key": "I642382b3d4bc91b94336ff5c19c175ef242b4f111395741965CRVW", + "primary_key": "I642382b3d4bc91b94336ff5c19c175ef242b4f111395741965Code-Review", "company_name": "Symantec" }, { "author_email": "achuprin@symantec.com", "correction_comment": "", - "primary_key": "Ie53854094b80dfd16c6fbdd9c2bd2ebf0e4e20841395739285CRVW", + "primary_key": "Ie53854094b80dfd16c6fbdd9c2bd2ebf0e4e20841395739285Code-Review", "company_name": "Symantec" }, { "author_email": "achuprin@symantec.com", "correction_comment": "", - "primary_key": "Ie53854094b80dfd16c6fbdd9c2bd2ebf0e4e20841395731923CRVW", + "primary_key": "Ie53854094b80dfd16c6fbdd9c2bd2ebf0e4e20841395731923Code-Review", "company_name": "Symantec" }, { "author_email": "achuprin@symantec.com", "correction_comment": "", - "primary_key": "I1bd5566395b00413593192f90bf2e756af01df261395731848CRVW", + "primary_key": "I1bd5566395b00413593192f90bf2e756af01df261395731848Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "Ic21246c3fd06a1957dd89df86422702212e06c451395678142CRVW", + "primary_key": "Ic21246c3fd06a1957dd89df86422702212e06c451395678142Code-Review", "company_name": "Symantec" }, { "author_email": "mdurnosvistov@symantec.com", "correction_comment": "", - "primary_key": "I642382b3d4bc91b94336ff5c19c175ef242b4f111395677621CRVW", + "primary_key": "I642382b3d4bc91b94336ff5c19c175ef242b4f111395677621Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I1bd5566395b00413593192f90bf2e756af01df261395672087CRVW", + "primary_key": "I1bd5566395b00413593192f90bf2e756af01df261395672087Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "Ie53854094b80dfd16c6fbdd9c2bd2ebf0e4e20841395670496CRVW", + "primary_key": "Ie53854094b80dfd16c6fbdd9c2bd2ebf0e4e20841395670496Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I642382b3d4bc91b94336ff5c19c175ef242b4f111395661022CRVW", + "primary_key": "I642382b3d4bc91b94336ff5c19c175ef242b4f111395661022Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "Ifc20bd3b8b0310b94077c3559d4970b156ed09cb1395655553CRVW", + "primary_key": "Ifc20bd3b8b0310b94077c3559d4970b156ed09cb1395655553Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "Ic21246c3fd06a1957dd89df86422702212e06c451395420776CRVW", + "primary_key": "Ic21246c3fd06a1957dd89df86422702212e06c451395420776Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_chudnovets@symantec.com", "correction_comment": "", - "primary_key": "I6fa056adb205f9979bf8fa6803bcc5e949f56d091395420581CRVW", + "primary_key": "I6fa056adb205f9979bf8fa6803bcc5e949f56d091395420581Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "Ic21246c3fd06a1957dd89df86422702212e06c451395410571CRVW", + "primary_key": "Ic21246c3fd06a1957dd89df86422702212e06c451395410571Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I642382b3d4bc91b94336ff5c19c175ef242b4f111395399394CRVW", + "primary_key": "I642382b3d4bc91b94336ff5c19c175ef242b4f111395399394Code-Review", "company_name": "Symantec" }, { "author_email": "achuprin@symantec.com", "correction_comment": "", - "primary_key": "I71dc4d7d72f489b8609843e78feba97213ff0f421395391100CRVW", + "primary_key": "I71dc4d7d72f489b8609843e78feba97213ff0f421395391100Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I644b0e4832aa4466906747bd440b302bd47d68a71395331103CRVW", + "primary_key": "I644b0e4832aa4466906747bd440b302bd47d68a71395331103Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_chudnovets@symantec.com", "correction_comment": "", - "primary_key": "I9c3dde735ce777cd069e49bfee442c6593a9cd741395328412CRVW", + "primary_key": "I9c3dde735ce777cd069e49bfee442c6593a9cd741395328412Code-Review", "company_name": "Symantec" }, { "author_email": "andrey_ostapenko@symantec.com", "correction_comment": "", - "primary_key": "I644b0e4832aa4466906747bd440b302bd47d68a71395328090CRVW", + "primary_key": "I644b0e4832aa4466906747bd440b302bd47d68a71395328090Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I9c3dde735ce777cd069e49bfee442c6593a9cd741395326349CRVW", + "primary_key": "I9c3dde735ce777cd069e49bfee442c6593a9cd741395326349Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "Ia57bd5f59040ef31936abe4433fa200c2ecc36231395322146CRVW", + "primary_key": "Ia57bd5f59040ef31936abe4433fa200c2ecc36231395322146Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "Ia57bd5f59040ef31936abe4433fa200c2ecc36231395321138CRVW", + "primary_key": "Ia57bd5f59040ef31936abe4433fa200c2ecc36231395321138Code-Review", "company_name": "Symantec" }, { "author_email": "andrey_ostapenko@symantec.com", "correction_comment": "", - "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395319270CRVW", + "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395319270Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_chudnovets@symantec.com", "correction_comment": "", - "primary_key": "I9c3dde735ce777cd069e49bfee442c6593a9cd741395317873CRVW", + "primary_key": "I9c3dde735ce777cd069e49bfee442c6593a9cd741395317873Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_chudnovets@symantec.com", "correction_comment": "", - "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395317245CRVW", + "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395317245Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395317066CRVW", + "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395317066Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395314381CRVW", + "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395314381Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_chudnovets@symantec.com", "correction_comment": "", - "primary_key": "If6beba2ea53bac36c61ef1ecf50295e2ec957a2e1395256003CRVW", + "primary_key": "If6beba2ea53bac36c61ef1ecf50295e2ec957a2e1395256003Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395254777CRVW", + "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395254777Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_chudnovets@symantec.com", "correction_comment": "", - "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395254711CRVW", + "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395254711Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_chudnovets@symantec.com", "correction_comment": "", - "primary_key": "If6beba2ea53bac36c61ef1ecf50295e2ec957a2e1395254415CRVW", + "primary_key": "If6beba2ea53bac36c61ef1ecf50295e2ec957a2e1395254415Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395251827CRVW", + "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395251827Code-Review", "company_name": "Symantec" }, { "author_email": "andrey_ostapenko@symantec.com", "correction_comment": "", - "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395248161CRVW", + "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395248161Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_chudnovets@symantec.com", "correction_comment": "", - "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395247419CRVW", + "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395247419Code-Review", "company_name": "Symantec" }, { "author_email": "andrey_ostapenko@symantec.com", "correction_comment": "", - "primary_key": "I04ccd5ceada67f7ffa6da1f7c6b435bf39ca70281395246800CRVW", + "primary_key": "I04ccd5ceada67f7ffa6da1f7c6b435bf39ca70281395246800Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I04ccd5ceada67f7ffa6da1f7c6b435bf39ca70281395244932CRVW", + "primary_key": "I04ccd5ceada67f7ffa6da1f7c6b435bf39ca70281395244932Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_chudnovets@symantec.com", "correction_comment": "", - "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395241833CRVW", + "primary_key": "I452488b3c9fe9aa8dfb021b4093e5793fbaa17651395241833Code-Review", "company_name": "Symantec" }, { @@ -2207,79 +2207,79 @@ { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I04ccd5ceada67f7ffa6da1f7c6b435bf39ca70281395238377CRVW", + "primary_key": "I04ccd5ceada67f7ffa6da1f7c6b435bf39ca70281395238377Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "Ie5ce0238f4c589aa7cefaa3f60477601df682f321395171843CRVW", + "primary_key": "Ie5ce0238f4c589aa7cefaa3f60477601df682f321395171843Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "Ie5ce0238f4c589aa7cefaa3f60477601df682f321395165923CRVW", + "primary_key": "Ie5ce0238f4c589aa7cefaa3f60477601df682f321395165923Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_minakov@symantec.com", "correction_comment": "", - "primary_key": "I5cd00217cc9eb0eae641f8da40259257b73140e91395059283CRVW", + "primary_key": "I5cd00217cc9eb0eae641f8da40259257b73140e91395059283Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I5cd00217cc9eb0eae641f8da40259257b73140e91395058614CRVW", + "primary_key": "I5cd00217cc9eb0eae641f8da40259257b73140e91395058614Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_minakov@symantec.com", "correction_comment": "", - "primary_key": "I180072856b030987fac582aac66877277e35f6441394559521CRVW", + "primary_key": "I180072856b030987fac582aac66877277e35f6441394559521Code-Review", "company_name": "Symantec" }, { "author_email": "alexander_minakov@symantec.com", "correction_comment": "", - "primary_key": "I7dace4e3f584188fda02755304c08a460c46e07c1394204796CRVW", + "primary_key": "I7dace4e3f584188fda02755304c08a460c46e07c1394204796Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I7dace4e3f584188fda02755304c08a460c46e07c1394201717CRVW", + "primary_key": "I7dace4e3f584188fda02755304c08a460c46e07c1394201717Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I883c24b7f56b11d586eb7d307444396a2d5aae051394119737CRVW", + "primary_key": "I883c24b7f56b11d586eb7d307444396a2d5aae051394119737Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I883c24b7f56b11d586eb7d307444396a2d5aae051394111179CRVW", + "primary_key": "I883c24b7f56b11d586eb7d307444396a2d5aae051394111179Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I7dace4e3f584188fda02755304c08a460c46e07c1394027087CRVW", + "primary_key": "I7dace4e3f584188fda02755304c08a460c46e07c1394027087Code-Review", "company_name": "Symantec" }, { "author_email": "andrey_ostapenko@symantec.com", "correction_comment": "", - "primary_key": "I5d182644f692f4ca874185139cb72990040215eb1393999465CRVW", + "primary_key": "I5d182644f692f4ca874185139cb72990040215eb1393999465Code-Review", "company_name": "Symantec" }, { "author_email": "maksym_iarmak@symantec.com", "correction_comment": "", - "primary_key": "I576066c79a164288771e4faecb4c9cfb7ff6f14c1393841154CRVW", + "primary_key": "I576066c79a164288771e4faecb4c9cfb7ff6f14c1393841154Code-Review", "company_name": "Symantec" }, { diff --git a/stackalytics/processor/record_processor.py b/stackalytics/processor/record_processor.py index 30d8eabdd..14a31c1c8 100644 --- a/stackalytics/processor/record_processor.py +++ b/stackalytics/processor/record_processor.py @@ -307,7 +307,7 @@ class RecordProcessor(object): def _make_mark_record(self, review, patch, approval): # copy everything and flatten user data mark = dict([(k, v) for k, v in six.iteritems(approval) - if k not in ['by', 'grantedOn', 'value']]) + if k not in ['by', 'grantedOn', 'value', 'description']]) reviewer = approval['by'] mark['record_type'] = 'mark' @@ -322,10 +322,6 @@ class RecordProcessor(object): mark['review_id'] = review['id'] mark['patch'] = int(patch['number']) - # map type from new Gerrit to old - mark['type'] = {'Approved': 'APRV', 'Code-Review': 'CRVW', - 'Verified': 'VRIF'}.get(mark['type'], mark['type']) - self._update_record_and_user(mark) return mark @@ -353,9 +349,8 @@ class RecordProcessor(object): continue # not reviewed by anyone for approval in patch['approvals']: - if approval['type'] not in ('CRVW', 'APRV', - 'Code-Review', 'Approved'): - continue # keep only Code-Review and Approved + if approval['type'] not in ('Code-Review', 'Workflow'): + continue # keep only Code-Review and Workflow if ('email' not in approval['by'] or 'username' not in approval['by']): continue # ignore @@ -683,7 +678,8 @@ class RecordProcessor(object): lambda: {'patch_number': 0, 'marks': []}) for record in self.runtime_storage_inst.get_all_records(): - if record['record_type'] == 'mark' and record['type'] == 'CRVW': + if (record['record_type'] == 'mark' and + record['type'] == 'Code-Review'): review_id = record['review_id'] patch_number = record['patch'] diff --git a/tests/api/test_api.py b/tests/api/test_api.py index 7c598f614..b58e2b7ad 100644 --- a/tests/api/test_api.py +++ b/tests/api/test_api.py @@ -122,11 +122,11 @@ def _generate_marks(): 'launchpad_id': 'john_doe', 'week': 2294, 'user_id': 'john_doe', 'description': 'Approved', 'author_name': 'John Doe', 'author_email': 'john_doe@gmail.com', - 'primary_key': str(uuid.uuid4()) + 'APRV', + 'primary_key': str(uuid.uuid4()) + 'Workflow', 'module': 'glance', 'patch': 2, 'record_type': 'mark', 'company_name': '*independent', 'branch': 'master', 'date': 1387860458, 'record_id': 37184, 'release': 'icehouse', - 'value': 1, 'type': 'APRV', + 'value': 1, 'type': 'Workflow', 'review_id': str(uuid.uuid4())} yield mark diff --git a/tests/api/test_stats.py b/tests/api/test_stats.py index a753e366e..e02c0a157 100644 --- a/tests/api/test_stats.py +++ b/tests/api/test_stats.py @@ -138,7 +138,7 @@ class TestAPIStats(test_api.TestAPI): review_id=['0123456789', '9876543210'], module=['glance'], value=[1], - type=['CRVW'], + type=['Code-Review'], author_name=['John Doe'], user_id=['john_doe']), test_api.make_records(record_type=['mark'], diff --git a/tests/unit/test_record_processor.py b/tests/unit/test_record_processor.py index 76decd24b..aaa56c0ca 100644 --- a/tests/unit/test_record_processor.py +++ b/tests/unit/test_record_processor.py @@ -648,7 +648,7 @@ class TestRecordProcessor(testtools.TestCase): 'username': 'bsmith'}, 'createdOn': 1385470730, 'approvals': [ - {'type': 'CRVW', 'description': 'Code Review', + {'type': 'Code-Review', 'description': 'Code Review', 'value': '1', 'grantedOn': 1385478464, 'by': {'name': 'John Doe', 'email': 'john_doe@ibm.com', 'username': 'john_doe'}}]}]} @@ -753,13 +753,13 @@ class TestRecordProcessor(testtools.TestCase): 'username': 'bsmith'}, 'createdOn': timestamp, 'approvals': [ - {'type': 'CRVW', 'description': 'Code Review', + {'type': 'Code-Review', 'description': 'Code Review', 'value': '2', 'grantedOn': timestamp, 'by': { 'name': 'John Doe', 'email': 'john_doe@ibm.com', 'username': 'john_doe'}}, - {'type': 'CRVW', 'description': 'Code Review', + {'type': 'Code-Review', 'description': 'Code Review', 'value': '-1', 'grantedOn': timestamp - 1, # differ 'by': { 'name': 'Homer Simpson', @@ -936,13 +936,13 @@ class TestRecordProcessor(testtools.TestCase): 'username': 'bsmith'}, 'createdOn': timestamp, 'approvals': [ - {'type': 'CRVW', 'description': 'Code Review', + {'type': 'Code-Review', 'description': 'Code Review', 'value': '2', 'grantedOn': timestamp - 1, 'by': { 'name': 'Homer Simpson', 'email': 'hsimpson@gmail.com', 'username': 'homer'}}, - {'type': 'CRVW', 'description': 'Code Review', + {'type': 'Code-Review', 'description': 'Code Review', 'value': '-2', 'grantedOn': timestamp, 'by': { 'name': 'John Doe', @@ -959,19 +959,19 @@ class TestRecordProcessor(testtools.TestCase): 'username': 'bsmith'}, 'createdOn': timestamp + 1, 'approvals': [ - {'type': 'CRVW', 'description': 'Code Review', + {'type': 'Code-Review', 'description': 'Code Review', 'value': '1', 'grantedOn': timestamp + 2, 'by': { 'name': 'Homer Simpson', 'email': 'hsimpson@gmail.com', 'username': 'homer'}}, - {'type': 'CRVW', 'description': 'Code Review', + {'type': 'Code-Review', 'description': 'Code Review', 'value': '-1', 'grantedOn': timestamp + 3, 'by': { 'name': 'Bart Simpson', 'email': 'bsimpson@gmail.com', 'username': 'bart'}}, - {'type': 'CRVW', 'description': 'Code Review', + {'type': 'Code-Review', 'description': 'Code Review', 'value': '2', 'grantedOn': timestamp + 4, 'by': { 'name': 'John Doe',