From f5ac3f6486d5b02b17bba5817ac7f585ff05f4dd Mon Sep 17 00:00:00 2001 From: Mark Fletcher Date: Thu, 23 May 2019 11:28:44 +0100 Subject: [PATCH] Experiment: Chart all bugs by severity disregarding state * View the open rate of bugs including those which: - Remain open - Have since been closed --- .../application/bugs_by_severity.coffee | 10 ++++++++++ app/assets/javascripts/application/queries.coffee | 15 +++++++++++++++ app/views/shared/_bugs_by_severity.html.haml | 13 ++++++++++++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/application/bugs_by_severity.coffee b/app/assets/javascripts/application/bugs_by_severity.coffee index 3c0db19..c442dd5 100644 --- a/app/assets/javascripts/application/bugs_by_severity.coffee +++ b/app/assets/javascripts/application/bugs_by_severity.coffee @@ -25,6 +25,14 @@ BugsClosedBySeverityPerMonthChart = (element) -> )) @charts.StackedBarChart(element, query.query_string, query.view_string) +BugsAllStatesBySeverityPerMonthChart = (element) -> + query = @queries.ScopedQuery(@queries.AllIssuablesCreatedPerMonthQuery( + @query_strings.Bugs, + @query_strings.Severities, + @query_strings.IssuesScope + )) + @charts.StackedBarChart(element, query.query_string, query.view_string) + $(document).ready () -> if document.getElementById('cumulative-bugs-created-severity-month') CumulativeBugsCreatedBySeverityPerMonthChart(document.getElementById('cumulative-bugs-created-severity-month')) @@ -32,3 +40,5 @@ $(document).ready () -> BugsCreatedBySeverityPerMonthChart(document.getElementById('bugs-created-severity-month')) if document.getElementById('bugs-closed-severity-month') BugsClosedBySeverityPerMonthChart(document.getElementById('bugs-closed-severity-month')) + if document.getElementById('bugs-all-states-severity-month') + BugsAllStatesBySeverityPerMonthChart(document.getElementById('bugs-all-states-severity-month')) diff --git a/app/assets/javascripts/application/queries.coffee b/app/assets/javascripts/application/queries.coffee index b52b4d8..51fd5df 100644 --- a/app/assets/javascripts/application/queries.coffee +++ b/app/assets/javascripts/application/queries.coffee @@ -39,6 +39,21 @@ project_query = (group_path, project_path, view_string, inner_query) -> } } ' + + AllIssuablesCreatedPerMonthQuery: (filter_labels_string, collection_labels_string, issuable_scope) -> + view_string: 'issuables_created_per_month', + query_string: ' + issuables_created_per_month(filter_labels:' + filter_labels_string + ', collection_labels: ' + collection_labels_string + ', issuable_scope: ' + issuable_scope + ') { + labels + datasets { + label + data + borderColor + backgroundColor + } + } + ' + IssuablesCreatedPerMonthQuery: (state_string, filter_labels_string, collection_labels_string, issuable_scope) -> view_string: 'issuables_created_per_month', query_string: ' diff --git a/app/views/shared/_bugs_by_severity.html.haml b/app/views/shared/_bugs_by_severity.html.haml index dc8b210..c608c73 100644 --- a/app/views/shared/_bugs_by_severity.html.haml +++ b/app/views/shared/_bugs_by_severity.html.haml @@ -24,7 +24,7 @@ .card-body %div %div.text-wrap - %p Displays number of open bugs created in a particular month grouped by their severity label + %p Displays number of open bugs created in a particular month grouped by their severity label. (This excludes bugs that have since been closed) .row.row-cards .col-lg-12 .card @@ -36,3 +36,14 @@ %div %div.text-wrap %p Displays number of bugs closed in a particular month grouped by their severity label + .row.row-cards + .col-lg-12 + .card + .card-header + %h3.card-title Bugs by Severity in all States + .card-body + %canvas#bugs-all-states-severity-month + .card-body + %div + %div.text-wrap + %p Displays number of bugs opened in a particular month grouped by their severity label. (This includes bugs that have since been closed) -- GitLab