一、项目背景
因为每日发送的项目报告中,bug总数、未完成数量、12级别严重数量等指标都是自己手动填的,比较繁琐,还不直观。所以想要在禅道上汇总一些报表,添加发送邮件的功能,可直接将项目报告发送到邮箱里
二、技术背景
后端:python+django
前端:vue
三、主要功能展示
可根据项目需求,从不同的角度做报表汇总
3.1、数据汇总
3.2、bug状态统计
3.3、未解决bug统计
3.4、已解决未验证bug统计
3.5、发送邮件
四、相关sql语句
4.1、bug数量总结
1 #项目bug情况统计 2 def project_bug_detail(productid,projectid): 3 # 1-bug总数量 4 bug_sql = "select count(*) from zt_bug where product='%s' and project='%s' and deleted='0'" % (productid, projectid) 5 6 # 2-未关闭bug数量 7 not_closed_bug_sql = "select count(*) from zt_bug where product = '%s' and project='%s' and deleted = '0' and status != 'closed'" % ( 8 productid, projectid) 9 10 # 3-已解决未关闭(待关闭)bug数量 11 resoved_bug_sql = "select count(*) from zt_bug where product = '%s' and project='%s' and deleted = '0' and `status` = 'resolved'" % ( 12 productid, projectid) 13 14 # 4-未解决的bug数量 15 active_bug_sql = "select count(*) from zt_bug where product = '%s' and project='%s' and deleted = '0' and `status` = 'active'" % ( 16 productid, projectid)
4.2、未解决bug人均分布
1 # 未解决bug人均分布 2 def people_bug(productid,projectid): 3 4 people_bug_sql = "select zt_user.realname,count(*) num from zt_bug LEFT JOIN zt_user on zt_bug.assignedTo = zt_user.account where (zt_bug.product = '%s' and zt_bug.project='%s' and zt_bug.deleted = '0' and zt_bug.status = 'active' and zt_bug.assignedTo != 'closed')group by zt_bug.assignedTo"%( 5 productid, projectid)
4.3、已解决待验证bug人均分布
1 # 已解决待验证bug人均分布 2 def verify_bug(productid,projectid): 3 4 verify_bug_sql = "select zt_user.realname,count(*) num from zt_bug LEFT JOIN zt_user on zt_bug.assignedTo = zt_user.account where (zt_bug.product = '%s' and zt_bug.project='%s' and zt_bug.deleted = '0' and zt_bug.status ='resolved' ) group by assignedTo"%( 5 productid, projectid)