-
Notifications
You must be signed in to change notification settings - Fork 946
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
[backend] Fix upsert indicator score since decay (#2859) #6100
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6100 +/- ##
==========================================
+ Coverage 66.73% 66.75% +0.01%
==========================================
Files 540 540
Lines 64180 64217 +37
Branches 5241 5241
==========================================
+ Hits 42832 42869 +37
Misses 21348 21348 ☔ View full report in Codecov by Sentry. |
cdc32a6
to
6368e31
Compare
0a37414
to
8b53c55
Compare
@@ -2380,6 +2380,10 @@ const upsertElement = async (context, user, element, type, basePatch, opts = {}) | |||
if (type === ENTITY_TYPE_INDICATOR) { | |||
if (updatePatch.decay_applied_rule && updatePatch.decay_base_score === element.decay_base_score) { | |||
logApp.debug('UPSERT INDICATOR -- no decay reset because no score change', { element, basePatch }); | |||
updatePatch.x_opencti_score = element.x_opencti_score; // don't change the score | |||
// don't reset valid_from & valid_until | |||
updatePatch.valid_from = element.valid_from; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure about this part, I wonder if we might have a case where valid_from / valid_until change with the same score
const labelledHistoryList: LabelledDecayHistory[] = []; | ||
decayHistory.forEach((history) => ( | ||
labelledHistoryList.push(getDisplayFor(history)) | ||
const currentScoreIndex = decayHistory.findLastIndex((history) => history.score === indicator.x_opencti_score); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix display of current score when we have multiple times in history the same score (it was displayed "Current stable score" each time)
9dfe632
to
e61be3c
Compare
e61be3c
to
0afa746
Compare
f5176b5
to
8e7e01f
Compare
Proposed changes
Related issues
Checklist