liana-filizola-copilot opened a new issue, #5093:
URL: https://github.com/apache/incubator-devlake/issues/5093

   ### 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
   
   Default graph for bitbucket is ordering by alphabetical order instead of 
time.
   
![image](https://user-images.githubusercontent.com/126186867/236268995-e9728b76-b5e3-49ec-9c63-cc2210f8d9f8.png)
   
   
   ### What do you expect to happen
   
   Graph should be ordered by month, not alphabetically.
   
   ### How to reproduce
   
   Open Jenkins default dashboards, check graph 2.1.
   
   ### Anything else
   
   Proposed solution by @msarzijl
   
   ```
   WITH _build_success_rate as(
     SELECT
       DATE_ADD(date(finished_date), INTERVAL 
-DAYOFMONTH(date(finished_date))+1 DAY) as time,
       result
     FROM
       cicd_pipelines
     WHERE
       $__timeFilter(finished_date)
       and id like "%jenkins%"
       and cicd_scope_id in ($job_id)
       -- the following condition will remove the month with incomplete data
       and finished_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL 
-DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)
   ),
   _build_success_rate_group as(
     SELECT 
       date(concat(date_format(time,'%Y/%m'),'/01')) as pre_month,
       1.0 * sum(case when result = 'SUCCESS' then 1 else 0 end)/ count(*) as 
build_success_rate
     FROM _build_success_rate
     GROUP BY 1
     ORDER BY 1
   )
   
   SELECT 
       date_format(pre_month,'%M %Y') as pre_month,
       build_success_rate as "Build Success Rate"
   FROM _build_success_rate_group
   
   ```
   
   
   ### Version
   
   v0.16.0
   
   ### Are you willing to submit PR?
   
   - [ ] 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