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

Create GET /detections/summary #594

Merged
merged 8 commits into from
Apr 29, 2024

Conversation

grindarius
Copy link
Contributor

✅ DoD

(use na when API docs (Release notes, etc) do not need to be updated)

📝 Summary

  • Create endpoint 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

  • Write any discovered & unresolved problems (link to created Jira issues)

💡 More ideas

Write any more ideas you have

@grindarius grindarius self-assigned this Apr 25, 2024
@grindarius grindarius linked an issue Apr 25, 2024 that may be closed by this pull request
@rassokhin-s rassokhin-s requested review from veckatimest and removed request for rassokhin-s April 26, 2024 11:30
}

counts.forEach(count => {
result[_.findKey(REVIEW_STATUS_MAPPING, status => status === count.review_status)] = count.count
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@grindarius grindarius merged commit 0e2a0e7 into develop Apr 29, 2024
3 checks passed
@grindarius grindarius deleted the feature/593-create-get-detectionssummary branch April 29, 2024 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create GET /detections/summary
2 participants