Skip to content

Tweak Javascript to approve detections#71

Open
flooie wants to merge 2 commits into
mainfrom
approval-tweaks
Open

Tweak Javascript to approve detections#71
flooie wants to merge 2 commits into
mainfrom
approval-tweaks

Conversation

@flooie
Copy link
Copy Markdown
Contributor

@flooie flooie commented May 14, 2026

Add small ui tweak to scanning portal

Also sync detections to disk every time.

flooie added 2 commits May 14, 2026 12:20
Tweak scrolling and approve functionality
Also update detections and syncing
Always keep detections in sync.
@flooie flooie requested a review from quevon24 May 14, 2026 16:25
det.confidence = 1.0;
var lbl = div.querySelector('.detection-label');
if (lbl) lbl.textContent = det.label + ' 1.0';
var sidebarItems = document.querySelectorAll('[data-unmatched-page="' + det.page_index + '"][data-unmatched-label="' + det.label + '"]');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greying by page+label affects all matching sidebar items, not just the approved one. If a page has two detections with the same label, both get greyed. Match by data-detection-id instead.

Comment thread scanning/services.py
}
)

rects = [e for e in rects if e["rects"]]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New page entries are appended at the end, so redaction_rects can end up out of page_index order after a delete-then-add. Maybe add a final sort to keep diffs clean.

Comment thread scanning/views_api.py
y0__lte=det["bbox"][1] + 15,
)
.order_by("pk")
.first()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old code updated all matching rows in the bbox window. The new code boosts only the first one (.order_by("pk").first()). The old behavior looks like it was guarding against duplicate active detections in the same area (e.g. two pipeline runs both leaving an active row). Is that scenario possible here? If yes, we shoul .update(confidence=1.0) on the queryset instead of .first() so we dont leave a stale low confidence twin behind. If duplicates can't happen, the new code is fine as-is, just worth confirming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: PRs to Review

Development

Successfully merging this pull request may close these issues.

2 participants