Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit88d212f

Browse files
committed
code-review fixes:
- API error, because of wrong key- remove colors, because that is handled by C3- add usernames, not user IDs- add 'TR-' notation
1 parent439861c commit88d212f

File tree

2 files changed

+44
-52
lines changed

2 files changed

+44
-52
lines changed

‎tcms/telemetry/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def performance_telemetry(query=None):
261261
# count only execution which are finished
262262
.exclude(status__weight=0)
263263
.order_by("run_id")
264-
.values("assignee_id","run_id")
264+
.values("assignee_id","run_id","assignee__username")
265265
)
266266

267267
result= {}
@@ -271,7 +271,7 @@ def performance_telemetry(query=None):
271271
run_id=execution["run_id"]
272272

273273
assignee_count= {}
274-
assignee=execution["assignee_id"]
274+
assignee=execution["assignee__username"]or""
275275
ifassigneeinassignee_count:
276276
assignee_count[assignee]=assignee_count[assignee]+1
277277
else:
Lines changed: 42 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
// TODO: account for more users
2-
constcolors=[
3-
'blue',
4-
'red',
5-
'gold',
6-
'orange',
7-
'green',
8-
'cyan',
9-
'purple',
10-
'black',
11-
'lightBlue',
12-
'lightGreen'
13-
]
14-
151
$(document).ready(()=>{
162
$('.selectpicker').selectpicker()
173
$('[data-toggle="tooltip"]').tooltip()
@@ -35,7 +21,7 @@ function reloadCharts () {
3521
if(testPlanIds.length){
3622
query.plan__in=testPlanIds
3723
}elseif(productIds.length){
38-
query.category__product_id__in=productIds
24+
query.case__category__product_id__in=productIds
3925
}
4026

4127
constdateBefore=$('#id_before')
@@ -53,58 +39,64 @@ function reloadCharts () {
5339

5440
// the actual result is in the same format, only it can be much bigger
5541
// and the chart may break
56-
constr={
57-
1:{
58-
1:1,
59-
3:2
60-
},
61-
2:{
62-
1:1,
63-
4:2
64-
},
65-
3:{
66-
1:1,
67-
3:1,
68-
5:1
69-
},
70-
4:{
71-
3:1,
72-
2:1
73-
},
74-
5:{
75-
1:5,
76-
3:2,
77-
4:1
78-
}
79-
}
80-
81-
drawChart(r)
42+
//const r = {
43+
// 1: {
44+
// "asankov": 1,
45+
// "atodorov": 2
46+
// },
47+
// 2: {
48+
// "asankov": 1,
49+
// "atodorov": 2
50+
// },
51+
// 3: {
52+
// "asankov": 1,
53+
// "atodorov": 1,
54+
// "": 1
55+
// },
56+
// 4: {
57+
// "asankov": 1,
58+
// "atodorov": 1
59+
// },
60+
// 5: {
61+
// "asankov": 5,
62+
// "atodorov": 2,
63+
// "bot": 1
64+
// }
65+
//}
66+
67+
drawChart(result)
8268
},true)
8369
}
8470

8571
functiondrawChart(data){
8672
// the X axis of the chart - run IDs
8773
constgroupedCategories=[]
88-
// map ofuser ID-> table column. we use map here for faster lookup byuser ID.
74+
// map ofusername-> table column. we use map here for faster lookup byusername.
8975
constgroupedColumnsDataMap={}
90-
constuserIds=newSet()
76+
constusernames=newSet()
9177

9278
// collect all the testers so that we know how much columns we will have
9379
Object.entries(data).forEach(([_testRunId,asigneeCount])=>{
94-
Object.entries(asigneeCount).forEach(([userId,_executionCount])=>userIds.add(userId))
80+
Object.entries(asigneeCount).forEach(([username,_executionCount])=>{
81+
// filter empty users
82+
// TODO: maybe we can do that on the API level
83+
if(username){
84+
usernames.add(username)
85+
}
86+
})
9587
})
9688

97-
userIds.forEach(userId=>(groupedColumnsDataMap[userId]=[`User${userId}`]))
89+
usernames.forEach(username=>(groupedColumnsDataMap[username]=[username]))
9890

9991
Object.entries(data).forEach(([testRunId,_asigneeCount])=>{
100-
groupedCategories.push(testRunId)
92+
groupedCategories.push(`TR-${testRunId}`)
10193

10294
constasigneesCount=data[testRunId]
10395

10496
// for each user in the groupedColumnsDataMap check if that user
10597
// is assigned any executions for this run.
106-
Object.entries(groupedColumnsDataMap).forEach(([userId,data])=>{
107-
constcount=asigneesCount[userId]
98+
Object.entries(groupedColumnsDataMap).forEach(([username,data])=>{
99+
constcount=asigneesCount[username]
108100
if(count){
109101
data.push(count)
110102
}else{
@@ -135,8 +127,8 @@ function drawChart (data) {
135127
type:'bar',
136128
columns:groupedColumnsData
137129
}
138-
chartConfig.color={
139-
pattern:colors
130+
chartConfig.zoom={
131+
enabled:true
140132
}
141133
c3.generate(chartConfig)
142134
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp