Skip to content

Commit 9af4124

Browse files
committed
fix: case inconsistency in sql (#4997)
* fix: case inconsistency in sql * fix: weekly bug retro select repo
1 parent 297861e commit 9af4124

21 files changed

Lines changed: 83 additions & 83 deletions

grafana/dashboards/BitBucket.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"editable": true,
1616
"gnetId": null,
1717
"graphTooltip": 0,
18-
"id": 12,
19-
"iteration": 1679476420040,
18+
"id": 28,
19+
"iteration": 1682062771301,
2020
"links": [],
2121
"panels": [
2222
{
@@ -966,5 +966,5 @@
966966
"timezone": "",
967967
"title": "BitBucket",
968968
"uid": "4LzQHZa4k",
969-
"version": 16
969+
"version": 1
970970
}

grafana/dashboards/ComponentAndFileLevelMetrics.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"editable": true,
1717
"gnetId": null,
1818
"graphTooltip": 0,
19-
"id": 17,
20-
"iteration": 1677030964408,
19+
"id": 20,
20+
"iteration": 1682062815355,
2121
"links": [],
2222
"panels": [
2323
{
@@ -991,7 +991,7 @@
991991
{
992992
"allValue": null,
993993
"current": {
994-
"selected": false,
994+
"selected": true,
995995
"text": [
996996
"All"
997997
],
@@ -1061,5 +1061,5 @@
10611061
"timezone": "",
10621062
"title": "Component and File-level Metrics",
10631063
"uid": "KxUh7IG4z",
1064-
"version": 4
1064+
"version": 3
10651065
}

grafana/dashboards/ContributorExperience.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"editable": true,
1616
"gnetId": null,
1717
"graphTooltip": 0,
18-
"id": 21,
19-
"iteration": 1677590412757,
18+
"id": 24,
19+
"iteration": 1682062826895,
2020
"links": [],
2121
"panels": [
2222
{
@@ -508,7 +508,7 @@
508508
"metricColumn": "none",
509509
"queryType": "randomWalk",
510510
"rawQuery": true,
511-
"rawSql": "select\n\tavg(TIMESTAMPDIFF(Minute,created_date,closed_date)/1440) as time_to_close\nfrom \n\tpull_requests pr\nwhere \n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n\tand status in ('closed', 'merged', 'declined')\n\tand pr.base_repo_id in ($repo_id)\n\n\n",
511+
"rawSql": "select\n\tavg(TIMESTAMPDIFF(Minute,created_date,closed_date)/1440) as time_to_close\nfrom \n\tpull_requests pr\nwhere \n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n\tand status in ('CLOSED', 'MERGED', 'DECLINED')\n\tand pr.base_repo_id in ($repo_id)\n\n\n",
512512
"refId": "A",
513513
"select": [
514514
[
@@ -590,7 +590,7 @@
590590
"metricColumn": "none",
591591
"queryType": "randomWalk",
592592
"rawQuery": true,
593-
"rawSql": "select\n 100 * sum(case when TIMESTAMPDIFF(Minute, created_date, closed_date) / 1440 < $prrt_sla then 1 else null end) / count(*)\nfrom \n\tpull_requests pr\nwhere \n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n\tand status in ('closed', 'merged', 'declined')\n\tand pr.base_repo_id in ($repo_id)\n\n\n",
593+
"rawSql": "select\n 100 * sum(case when TIMESTAMPDIFF(Minute, created_date, closed_date) / 1440 < $prrt_sla then 1 else null end) / count(*)\nfrom \n\tpull_requests pr\nwhere \n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n\tand status in ('CLOSED', 'MERGED', 'DECLINED')\n\tand pr.base_repo_id in ($repo_id)\n\n\n",
594594
"refId": "A",
595595
"select": [
596596
[
@@ -672,7 +672,7 @@
672672
"metricColumn": "none",
673673
"queryType": "randomWalk",
674674
"rawQuery": true,
675-
"rawSql": "select\n 100 * count(distinct case when status in ('closed', 'merged', 'declined') and merged_date is null then id else null end)/count(distinct case when status in ('closed', 'merged', 'declined') then id else null end) as ratio\nfrom \n\tpull_requests pr\nwhere\n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n and pr.base_repo_id in ($repo_id)",
675+
"rawSql": "select\n 100 * count(distinct case when status in ('CLOSED', 'MERGED', 'DECLINED') and merged_date is null then id else null end)/count(distinct case when status in ('CLOSED', 'MERGED', 'DECLINED') then id else null end) as ratio\nfrom \n\tpull_requests pr\nwhere\n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n and pr.base_repo_id in ($repo_id)",
676676
"refId": "A",
677677
"select": [
678678
[
@@ -828,5 +828,5 @@
828828
"timezone": "",
829829
"title": "Contributor Experience",
830830
"uid": "bwsP5Nz4z",
831-
"version": 6
831+
"version": 9
832832
}

grafana/dashboards/DORA.json

Lines changed: 6 additions & 6 deletions
Large diffs are not rendered by default.

grafana/dashboards/DemoAverageRequirementLeadTimeByAssignee.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"editable": true,
1616
"gnetId": null,
1717
"graphTooltip": 0,
18-
"id": 3,
18+
"id": 1,
1919
"links": [
2020
{
2121
"asDropdown": false,
@@ -111,7 +111,7 @@
111111
"metricColumn": "none",
112112
"queryType": "randomWalk",
113113
"rawQuery": true,
114-
"rawSql": "with _requirements as(\n select \n DATE_ADD(date(resolution_date), INTERVAL -DAY(date(resolution_date))+1 DAY) as time,\n assignee_name as assignee,\n avg(lead_time_minutes)/1440 as lead_time\n from issues i\n where \n type = 'Requirement'\n and assignee_id != ''\n and $__timeFilter(resolution_date)\n group by 1,2\n),\n\n\nthis_month as(\n\tselect \n\t\tDATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY) as this_month\n),\n\nlast_month as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -1 MONTH) as last_month\n),\n\nthe_month_before_last as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -2 MONTH) as the_month_before_last\n),\n\nthis_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as this_month_count,\n\t\ttime as this_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT this_month from this_month)\n),\n\nlast_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as last_month_count,\n\t\ttime as last_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT last_month from last_month)\n),\n\nthe_month_before_last_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as the_month_before_last_count,\n\t\ttime as the_month_before_last\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT the_month_before_last from the_month_before_last)\n)\n\nSELECT\n COALESCE(NULLIF(tmr.assignee,''), NULLIF(lmr.assignee,''), tmblr.assignee) AS 'Assignee',\n\tCOALESCE(tmblr.the_month_before_last_count,0) AS \"The Month before Last\",\n\tCOALESCE(lmr.last_month_count,0) AS \"Last Month\",\n\tCOALESCE(tmr.this_month_count,0) AS \"This Month\",\n\tcase \n\t when lmr.last_month_count is null or tmr.this_month_count is null then '-'\n\t else concat(FORMAT(100 * (tmr.this_month_count - lmr.last_month_count)/lmr.last_month_count,1),'%') end as \"Changes in last 2 month\"\nFrom the_month_before_last_record tmblr \n left join last_month_record lmr on tmblr.assignee = lmr.assignee\n left join this_month_record tmr on tmblr.assignee = tmr.assignee\norder by 2",
114+
"rawSql": "with _requirements as(\n select \n DATE_ADD(date(resolution_date), INTERVAL -DAY(date(resolution_date))+1 DAY) as time,\n assignee_name as assignee,\n avg(lead_time_minutes)/1440 as lead_time\n from issues i\n where \n type = 'REQUIREMENT'\n and assignee_id != ''\n and $__timeFilter(resolution_date)\n group by 1,2\n),\n\n\nthis_month as(\n\tselect \n\t\tDATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY) as this_month\n),\n\nlast_month as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -1 MONTH) as last_month\n),\n\nthe_month_before_last as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -2 MONTH) as the_month_before_last\n),\n\nthis_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as this_month_count,\n\t\ttime as this_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT this_month from this_month)\n),\n\nlast_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as last_month_count,\n\t\ttime as last_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT last_month from last_month)\n),\n\nthe_month_before_last_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as the_month_before_last_count,\n\t\ttime as the_month_before_last\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT the_month_before_last from the_month_before_last)\n)\n\nSELECT\n COALESCE(NULLIF(tmr.assignee,''), NULLIF(lmr.assignee,''), tmblr.assignee) AS 'Assignee',\n\tCOALESCE(tmblr.the_month_before_last_count,0) AS \"The Month before Last\",\n\tCOALESCE(lmr.last_month_count,0) AS \"Last Month\",\n\tCOALESCE(tmr.this_month_count,0) AS \"This Month\",\n\tcase \n\t when lmr.last_month_count is null or tmr.this_month_count is null then '-'\n\t else concat(FORMAT(100 * (tmr.this_month_count - lmr.last_month_count)/lmr.last_month_count,1),'%') end as \"Changes in last 2 month\"\nFrom the_month_before_last_record tmblr \n left join last_month_record lmr on tmblr.assignee = lmr.assignee\n left join this_month_record tmr on tmblr.assignee = tmr.assignee\norder by 2",
115115
"refId": "A",
116116
"select": [
117117
[
@@ -182,7 +182,7 @@
182182
"metricColumn": "none",
183183
"queryType": "randomWalk",
184184
"rawQuery": true,
185-
"rawSql": "with _requirements as(\n select \n DATE_ADD(date(resolution_date), INTERVAL -DAY(date(resolution_date))+1 DAY) as time,\n assignee_name as assignee,\n avg(lead_time_minutes)/1440 as lead_time\n from issues i\n where \n type = 'Requirement'\n and assignee_id != ''\n and $__timeFilter(resolution_date)\n group by 1,2\n),\n\n\nthis_month as(\n\tselect \n\t\tDATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY) as this_month\n),\n\nlast_month as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -1 MONTH) as last_month\n),\n\nthe_month_before_last as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -2 MONTH) as the_month_before_last\n),\n\nthis_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as this_month_count,\n\t\ttime as this_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT this_month from this_month)\n),\n\nlast_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as last_month_count,\n\t\ttime as last_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT last_month from last_month)\n),\n\nthe_month_before_last_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as the_month_before_last_count,\n\t\ttime as the_month_before_last\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT the_month_before_last from the_month_before_last)\n)\n\nSELECT\n COALESCE(NULLIF(tmr.assignee,''), NULLIF(lmr.assignee,''), tmblr.assignee) AS 'Assignee',\n\tCOALESCE(tmblr.the_month_before_last_count,0) AS \"The Month before Last\",\n\tCOALESCE(lmr.last_month_count,0) AS \"Last Month\",\n\tCOALESCE(tmr.this_month_count,0) AS \"This Month\",\n\tcase \n\t when lmr.last_month_count is null or tmr.this_month_count is null then '-'\n\t else concat(FORMAT(100 * (tmr.this_month_count - lmr.last_month_count)/lmr.last_month_count,1),'%') end as \"Changes in last 2 month\"\nFrom the_month_before_last_record tmblr \n left join last_month_record lmr on tmblr.assignee = lmr.assignee\n left join this_month_record tmr on tmblr.assignee = tmr.assignee\norder by 2",
185+
"rawSql": "with _requirements as(\n select \n DATE_ADD(date(resolution_date), INTERVAL -DAY(date(resolution_date))+1 DAY) as time,\n assignee_name as assignee,\n avg(lead_time_minutes)/1440 as lead_time\n from issues i\n where \n type = 'REQUIREMENT'\n and assignee_id != ''\n and $__timeFilter(resolution_date)\n group by 1,2\n),\n\n\nthis_month as(\n\tselect \n\t\tDATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY) as this_month\n),\n\nlast_month as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -1 MONTH) as last_month\n),\n\nthe_month_before_last as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -2 MONTH) as the_month_before_last\n),\n\nthis_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as this_month_count,\n\t\ttime as this_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT this_month from this_month)\n),\n\nlast_month_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as last_month_count,\n\t\ttime as last_month\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT last_month from last_month)\n),\n\nthe_month_before_last_record as(\n\tSELECT\n\t\tassignee,\n\t\tlead_time as the_month_before_last_count,\n\t\ttime as the_month_before_last\n\tfrom _requirements\n\tWHERE \n\t\ttime in (SELECT the_month_before_last from the_month_before_last)\n)\n\nSELECT\n COALESCE(NULLIF(tmr.assignee,''), NULLIF(lmr.assignee,''), tmblr.assignee) AS 'Assignee',\n\tCOALESCE(tmblr.the_month_before_last_count,0) AS \"The Month before Last\",\n\tCOALESCE(lmr.last_month_count,0) AS \"Last Month\",\n\tCOALESCE(tmr.this_month_count,0) AS \"This Month\",\n\tcase \n\t when lmr.last_month_count is null or tmr.this_month_count is null then '-'\n\t else concat(FORMAT(100 * (tmr.this_month_count - lmr.last_month_count)/lmr.last_month_count,1),'%') end as \"Changes in last 2 month\"\nFrom the_month_before_last_record tmblr \n left join last_month_record lmr on tmblr.assignee = lmr.assignee\n left join this_month_record tmr on tmblr.assignee = tmr.assignee\norder by 2",
186186
"refId": "A",
187187
"select": [
188188
[
@@ -246,5 +246,5 @@
246246
"timezone": "",
247247
"title": "Demo-Average Requirement Lead Time By Assignee",
248248
"uid": "q27fk7cnk",
249-
"version": 2
249+
"version": 6
250250
}

grafana/dashboards/DemoCommitCountByAuthor.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"editable": true,
1616
"gnetId": null,
1717
"graphTooltip": 0,
18-
"id": 4,
18+
"id": 5,
1919
"links": [
2020
{
2121
"asDropdown": false,
@@ -253,5 +253,5 @@
253253
"timezone": "",
254254
"title": "Demo-Commit Count by Author",
255255
"uid": "F0iYknc7z",
256-
"version": 2
256+
"version": 3
257257
}

grafana/dashboards/DemoDetailedBugInfo.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"editable": true,
1616
"gnetId": null,
1717
"graphTooltip": 0,
18-
"id": 10,
18+
"id": 2,
1919
"links": [
2020
{
2121
"asDropdown": false,
@@ -114,7 +114,7 @@
114114
"metricColumn": "none",
115115
"queryType": "randomWalk",
116116
"rawQuery": true,
117-
"rawSql": "with bugs as(\n select \n DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY) as time,\n count(*) as bug_count\n from issues i\n where \n type = 'Bug'\n and $__timeFilter(created_date)\n group by 1\n order by 1 desc\n)\n\nselect\n date_format(time,'%M %Y') as month,\n bug_count as 'Bug Count over Month'\nfrom bugs\norder by time asc",
117+
"rawSql": "with bugs as(\n select \n DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY) as time,\n count(*) as bug_count\n from issues i\n where \n type = 'BUG'\n and $__timeFilter(created_date)\n group by 1\n order by 1 desc\n)\n\nselect\n date_format(time,'%M %Y') as month,\n bug_count as 'Bug Count over Month'\nfrom bugs\norder by time asc",
118118
"refId": "A",
119119
"select": [
120120
[
@@ -249,7 +249,7 @@
249249
"metricColumn": "none",
250250
"queryType": "randomWalk",
251251
"rawQuery": true,
252-
"rawSql": "select \n title,\n description,\n case when assignee_id = '' then '-' else assignee_name end as assignee,\n status,\n created_date,\n url\n from issues i\n where \n type = 'Bug'\n and $__timeFilter(created_date)\n order by created_date desc",
252+
"rawSql": "select \n title,\n description,\n case when assignee_id = '' then '-' else assignee_name end as assignee,\n status,\n created_date,\n url\n from issues i\n where \n type = 'BUG'\n and $__timeFilter(created_date)\n order by created_date desc",
253253
"refId": "A",
254254
"select": [
255255
[
@@ -311,5 +311,5 @@
311311
"timezone": "",
312312
"title": "Demo-Detailed Bug Info",
313313
"uid": "s48Lzn5nz",
314-
"version": 2
314+
"version": 8
315315
}

grafana/dashboards/DemoHowFastDoWeRespondToCustomerRequirements.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"group": [],
109109
"metricColumn": "none",
110110
"rawQuery": true,
111-
"rawSql": "with _requirements as(\n select \n DATE_ADD(date(resolution_date), INTERVAL -DAY(date(resolution_date))+1 DAY) as time,\n avg(lead_time_minutes)/1440 as lead_time_days\n from issues i\n where \n type = 'Requirement'\n and $__timeFilter(resolution_date)\n group by time\n)\n\nselect\n date_format(time,'%M %Y') as month,\n lead_time_days as 'Average Requirement Lead Time (day)'\nfrom _requirements\norder by time asc",
111+
"rawSql": "with _requirements as(\n select \n DATE_ADD(date(resolution_date), INTERVAL -DAY(date(resolution_date))+1 DAY) as time,\n avg(lead_time_minutes)/1440 as lead_time_days\n from issues i\n where \n type = 'REQUIREMENT'\n and $__timeFilter(resolution_date)\n group by time\n)\n\nselect\n date_format(time,'%M %Y') as month,\n lead_time_days as 'Average Requirement Lead Time (day)'\nfrom _requirements\norder by time asc",
112112
"refId": "A",
113113
"select": [
114114
[
@@ -219,5 +219,5 @@
219219
"timezone": "",
220220
"title": "Demo-How fast do we respond to customer requirements?",
221221
"uid": "SupYz7c7z",
222-
"version": 2
222+
"version": 4
223223
}

grafana/dashboards/DemoIsThisMonthMoreProductiveThanLast.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"editable": true,
1616
"gnetId": null,
1717
"graphTooltip": 0,
18-
"id": 5,
18+
"id": 12,
1919
"links": [
2020
{
2121
"asDropdown": false,
@@ -249,5 +249,5 @@
249249
"timezone": "",
250250
"title": "Demo-Is this month more productive than last?",
251251
"uid": "ddREk75nk",
252-
"version": 2
252+
"version": 3
253253
}

grafana/dashboards/DemoWasOurQualityImprovedOrNot.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
"metricColumn": "none",
110110
"queryType": "randomWalk",
111111
"rawQuery": true,
112-
"rawSql": "with line_of_code as (\n\tselect \n\t DATE_ADD(date(authored_date), INTERVAL -DAY(date(authored_date))+1 DAY) as time,\n\t sum(additions + deletions) as line_count\n\tfrom \n\t commits\n\twhere \n\t message not like 'Merge%'\n\t and $__timeFilter(authored_date)\n\tgroup by 1\n),\n\n\nbug_count as(\n select \n DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY) as time,\n count(*) as bug_count\n from issues i\n where \n type = 'Bug'\n and $__timeFilter(created_date)\n group by 1\n),\n\n\nbug_count_per_1k_loc as(\n select \n loc.time,\n 1.0 * bc.bug_count / loc.line_count * 1000 as bug_count_per_1k_loc\n from \n line_of_code loc\n left join bug_count bc on bc.time = loc.time\n where\n bc.bug_count is not null \n and loc.line_count is not null \n and loc.line_count != 0\n)\n\nselect \n date_format(time,'%M %Y') as month,\n bug_count_per_1k_loc as 'Bug Count per 1000 Lines of Code'\nfrom bug_count_per_1k_loc \norder by time;",
112+
"rawSql": "with line_of_code as (\n\tselect \n\t DATE_ADD(date(authored_date), INTERVAL -DAY(date(authored_date))+1 DAY) as time,\n\t sum(additions + deletions) as line_count\n\tfrom \n\t commits\n\twhere \n\t message not like 'Merge%'\n\t and $__timeFilter(authored_date)\n\tgroup by 1\n),\n\n\nbug_count as(\n select \n DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY) as time,\n count(*) as bug_count\n from issues i\n where \n type = 'BUG'\n and $__timeFilter(created_date)\n group by 1\n),\n\n\nbug_count_per_1k_loc as(\n select \n loc.time,\n 1.0 * bc.bug_count / loc.line_count * 1000 as bug_count_per_1k_loc\n from \n line_of_code loc\n left join bug_count bc on bc.time = loc.time\n where\n bc.bug_count is not null \n and loc.line_count is not null \n and loc.line_count != 0\n)\n\nselect \n date_format(time,'%M %Y') as month,\n bug_count_per_1k_loc as 'Bug Count per 1000 Lines of Code'\nfrom bug_count_per_1k_loc \norder by time;",
113113
"refId": "A",
114114
"select": [
115115
[
@@ -216,5 +216,5 @@
216216
"timezone": "",
217217
"title": "Demo-Was our quality improved or not?",
218218
"uid": "G4DEk75nz",
219-
"version": 2
219+
"version": 4
220220
}

0 commit comments

Comments
 (0)