Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
inspect_report
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhengjinlei
inspect_report
Commits
0897f51a
Commit
0897f51a
authored
Jun 09, 2020
by
zhengjinlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改分数
parent
2218555b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
report_utils.py
src/inspect_report/utils/report_utils.py
+6
-6
No files found.
src/inspect_report/utils/report_utils.py
View file @
0897f51a
...
...
@@ -37,18 +37,18 @@ def get_inspect_rule(task):
service_items
=
list
(
set
(
rule
[
'scoreItemIds'
])
.
intersection
(
set
(
score_item_ids
)))
items
=
ScoreItems
.
objects
.
filter
(
id__in
=
service_items
)
.
values
(
'name'
,
'score'
,
'scoreType'
)
for
item
in
items
:
score_item_service
[
item
[
'
name
'
]]
=
item
[
'score'
]
if
item
[
'scoreType'
]
==
1
else
-
item
[
'score'
]
score_item_service
[
item
[
'
id
'
]]
=
item
[
'score'
]
if
item
[
'scoreType'
]
==
1
else
-
item
[
'score'
]
elif
rule
[
'type'
]
==
'业务类'
:
business_score
=
ScoreItems
.
objects
.
filter
(
id__in
=
rule
[
'scoreItemIds'
])
.
aggregate
(
ss
=
Sum
(
'score'
))[
'ss'
]
business_items
=
list
(
set
(
rule
[
'scoreItemIds'
])
.
intersection
(
set
(
score_item_ids
)))
items
=
ScoreItems
.
objects
.
filter
(
id__in
=
business_items
)
.
values
(
'name'
,
'score'
,
'scoreType'
)
for
item
in
items
:
score_item_business
[
item
[
'
name
'
]]
=
item
[
'score'
]
if
item
[
'scoreType'
]
==
1
else
-
item
[
'score'
]
score_item_business
[
item
[
'
id
'
]]
=
item
[
'score'
]
if
item
[
'scoreType'
]
==
1
else
-
item
[
'score'
]
elif
rule
[
'type'
]
==
'0分项'
:
zero_items
=
list
(
set
(
rule
[
'scoreItemIds'
])
.
intersection
(
set
(
score_item_ids
)))
items
=
ScoreItems
.
objects
.
filter
(
id__in
=
zero_items
)
.
values
(
'name'
,
'score'
,
'scoreType'
)
for
item
in
items
:
score_item_zero
[
item
[
'
name
'
]]
=
item
[
'score'
]
if
item
[
'scoreType'
]
==
1
else
-
item
[
'score'
]
score_item_zero
[
item
[
'
id
'
]]
=
item
[
'score'
]
if
item
[
'scoreType'
]
==
1
else
-
item
[
'score'
]
return
service_score
,
business_score
,
validate_zero
,
score_item_service
,
score_item_business
,
score_item_zero
...
...
@@ -149,11 +149,11 @@ def single_score_stat(t, create_date, stat_count=0):
validate_zero
=
0
for
m
in
score_item
:
if
m
[
'scoreItem
Name
'
]
in
score_item_service
.
keys
():
if
m
[
'scoreItem
Id
'
]
in
score_item_service
.
keys
():
service_score
-=
m
[
'score'
]
if
m
[
'scoreType'
]
==
1
else
-
m
[
'score'
]
if
m
[
'scoreItem
Name
'
]
in
score_item_business
.
keys
():
if
m
[
'scoreItem
Id
'
]
in
score_item_business
.
keys
():
business_score
-=
m
[
'score'
]
if
m
[
'scoreType'
]
==
1
else
-
m
[
'score'
]
if
m
[
'scoreItem
Name
'
]
in
score_item_zero
.
keys
():
if
m
[
'scoreItem
Id
'
]
in
score_item_zero
.
keys
():
validate_zero
+=
1
if
validate_zero
>
0
:
score
=
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment