Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resultEngine store/return NULL instead of zero #720

Merged
merged 4 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/source/service/mysql/AssetService.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ exports.queryChecklist = async function (inProjection, inPredicates, elevate, us
'r.severity',
`cast(COUNT(scap.ruleId) > 0 as json) as "autoCheckAvailable"`,
`result.api as "result"`,
`review.resultEngine`,
`CASE WHEN review.resultEngine = 0 THEN NULL ELSE review.resultEngine END as resultEngine`,
`review.autoResult`,
`status.api as "status"`
]
Expand Down
12 changes: 6 additions & 6 deletions api/source/service/mysql/ReviewService.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const writeQueries = {
:assetId,
i.ruleId,
i.resultId,
i.resultEngine,
CASE WHEN i.resultEngine = 0 THEN NULL ELSE i.resultEngine END,
COALESCE(i.detail,''),
COALESCE(i.comment,''),
CASE WHEN i.autoResult THEN 1 ELSE 0 END,
Expand Down Expand Up @@ -182,7 +182,7 @@ exports.getReviews = async function (inProjection = [], inPredicates = {}, userO
) as assetLabelIds`,
'r.ruleId',
'result.api as "result"',
'r.resultEngine',
'CASE WHEN r.resultEngine = 0 THEN NULL ELSE r.resultEngine END as resultEngine',
"COALESCE(LEFT(r.detail,32767),'') as detail",
"COALESCE(LEFT(r.comment,32767),'') as comment",
'r.autoResult',
Expand Down Expand Up @@ -264,7 +264,7 @@ exports.getReviews = async function (inProjection = [], inPredicates = {}, userO
json_object(
'ts' , DATE_FORMAT(rh.ts, '%Y-%m-%dT%H:%i:%sZ'),
'result', result.api,
'resultEngine', rh.resultEngine,
'resultEngine', CASE WHEN rh.resultEngine = 0 THEN NULL ELSE rh.resultEngine END,
'detail', COALESCE(LEFT(rh.detail,32767),''),
'comment', COALESCE(LEFT(rh.comment,32767),''),
'autoResult', cast(rh.autoResult is true as json),
Expand Down Expand Up @@ -398,7 +398,7 @@ exports.exportReviews = async function (includeHistory = false) {
'CAST(r.assetId as char) as assetId',
'r.ruleId',
'result.api as "result"',
'r.resultEngine',
'CASE WHEN r.resultEngine = 0 THEN NULL ELSE r.resultEngine END as resultEngine',
'LEFT(r.detail,32767) as detail',
'LEFT(r.comment,32767) as comment',
'CAST(r.userId as char) as userId',
Expand Down Expand Up @@ -427,7 +427,7 @@ exports.exportReviews = async function (includeHistory = false) {
json_object(
'ts' , DATE_FORMAT(rh.ts, '%Y-%m-%dT%H:%i:%sZ'),
'result', result.api,
'resultEngine', rh.resultEngine,
'resultEngine', CASE WHEN rh.resultEngine = 0 THEN NULL ELSE rh.resultEngine END,
'detail', LEFT(rh.detail,32767),
'comment', LEFT(rh.comment,32767),
'userId', CAST(rh.userId as char),
Expand Down Expand Up @@ -563,7 +563,7 @@ exports.putReviewsByAsset = async function( assetId, reviews, userObject, resetC
statusTs,
statusId,
touchTs,
resultEngine
CASE WHEN resultEngine = 0 THEN NULL ELSE resultEngine END
FROM
review
WHERE
Expand Down
Loading