-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create GET /detections/summary
#594
Conversation
# Conflicts: # CHANGELOG.md
core/detections/dao/index.js
Outdated
} | ||
|
||
counts.forEach(count => { | ||
result[_.findKey(REVIEW_STATUS_MAPPING, status => status === count.review_status)] = count.count |
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.
sorry bro, I didn't notice that we need to perform this backward-mapping. The previous version was better
You could do it like this, but I'm not sure it is better
const result = {}
counts.forEach(count => {
result[count.review_status] = count.count
})
return {
unreviewed: result[REVIEW_STATUS_MAPPING.unreviewed] || 0,
rejected: result[REVIEW_STATUS_MAPPING.rejected] || 0,
uncertain: result[REVIEW_STATUS_MAPPING.uncertain] || 0,
confirmed: result[REVIEW_STATUS_MAPPING.confirmed] || 0,
}
This is up to you.
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.
This choice is a bit cleaner to be honest, I'll be switching to this one.
✅ DoD
GET /detections/summary
#593(use na when API docs (Release notes, etc) do not need to be updated)
📝 Summary
GET /detections/summary
to retrieve detection counts information for each validation status based on given filters.📸 Examples
Put screenshots or response/request examples here!
🛑 Problems
💡 More ideas
Write any more ideas you have