skucherenko-voxel opened a new issue, #5886:
URL: https://github.com/apache/incubator-devlake/issues/5886

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   After pushing some incidents via a webhook, they do not appear in the 
following chart:
   `Step 1. All types of issues in table.issues (rows with 2 green columns will 
be used to construct project_issue_metrics)`
   
   ### What do you expect to happen
   
   They should appear in some way, for instance:
   
![image](https://github.com/apache/incubator-devlake/assets/100363292/f4ba16d2-246e-40c9-938a-f140b492f1ca)
   
   
   ### How to reproduce
   
   ### Environment:
   Have a new project. with repos (`GitHub` in my case) and builds to it 
(`Jenkins` in my case). Create a webhook for issues and include it to the 
project.
   
   ### Steps
   1. Publish some incidents via the webhook. Postman with a JSON like this as 
a body gets the job done:
   ```
   {
   "id": "webhook:1",
   "issue_key": "123123",
   "title": "a feature from ABC",
   "status": "DONE",
   "original_status": "created",
   "created_date": "2023-08-08T15:00:00+01:00",
   "lead_time_minutes": 360,
   "type": "INCIDENT"
   }
   ```
   2. Hit "Collect all data" in Devlake
   3. In Grafana, navigate to the `DORA Dashboard Validation` dashboard and go 
to `Step 1. All types of issues in table.issues (rows with 2 green columns will 
be used to construct project_issue_metrics)` chart.
   4. See if the chart is empty
   
   
   ### Anything else
   
   The issue is caused by a conditional in the SQL script behind the chart:
   
   ```
   -- get the incident created within the selected time period in the top-right 
corner
   SELECT
        pm.project_name,
        IF(pm.project_name in ($project),'This project is selected','Not 
Selected') as select_status,
        i._raw_data_table,
        i.type, 
        count(1) as issue_count
   FROM
        issues i
     join board_issues bi on i.id = bi.issue_id
     join boards b on bi.board_id = b.id
     join project_mapping pm on b.id = pm.row_id ------------------------> and 
pm.`table` = 'boards' <---------------------- the failing part
   WHERE
     pm.project_name in ($project)
        and i.type = 'INCIDENT'
        and $__timeFilter(i.created_date)
   GROUP BY pm.project_name, select_status,i._raw_data_table, i.type
   ```
   
   As Louis Zhang suggests, the issue gets solved with replacing
   ```
   and pm.`table` = 'boards'
   ```
   by
   ```
   and pm.`table` = 'cicd_scopes'
   ```
   
   ### Version
   
   v0.18.0-beta3
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to