Skip to content

feat: show Survey ID on the Correct Data page and in the Correction Log - #264

Merged
iabaako merged 12 commits into
fix/253-standardize-reapply-error-handlingfrom
feat/correction-log-show-survey-id
Aug 18, 2026
Merged

feat: show Survey ID on the Correct Data page and in the Correction Log#264
iabaako merged 12 commits into
fix/253-standardize-reapply-error-handlingfrom
feat/correction-log-show-survey-id

Conversation

@iabaako

@iabaako iabaako commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Pull Request Summary 🚀

What does this PR do? 📝

  • Displays the corresponding Survey ID when a KEY is selected on the Correct Data page, if a Survey ID column is configured for that page.
  • Shows the Survey ID in the Correction Log table itself (the existing "ID" column, previously always blank, now reads "Survey ID" and is populated).
  • Raises tests/views/test_correction_view.py coverage from 37.58% to 84.71% (project gate is 80%).

Why is this change needed? 🤔

Reviewers correcting data need to see the human-readable Survey ID alongside the internal KEY, both while making a correction and when reviewing past corrections in the log. The "ID" column already existed in the log's schema but was never populated, so it rendered blank.

How was this implemented? 🛠️

  • TabConfig gained a survey_id: str | None field, sourced from load_tab_config's page config.
  • render_add_correction_form looks up and displays the Survey ID (via get_current_value) once a KEY is selected, and threads it through _render_apply_button / _handle_apply_correction.
  • CorrectionProcessor.apply_correction gained a survey_id_value parameter, passed through to add_correction_entry as current_id (previously hardcoded to None).
  • _build_correction_log_display renames the "ID" column to "Survey ID" for display, keeping the underlying persisted column name unchanged for backward compatibility.
  • Added real (non-mocked-logic) unit tests for most correction_view.py functions, including a TestMain class for the page's main() entry point, replacing several tests that only duplicated logic inline rather than exercising the real functions.

How to test or reproduce ? 🧪

  1. Configure a Survey ID column for an HFC page in project settings.
  2. Go to the Correct Data page, select a tab, and pick a KEY value — the Survey ID should appear beneath the KEY selector.
  3. Submit a correction, then check the Correction Log table — the "Survey ID" column should show the value instead of being blank.
  4. Run uv run python -m pytest tests/views/test_correction_view.py --cov=datasure.views.correction_view --cov-report=term-missing -q to confirm ≥80% coverage.

Screenshots (if applicable) 📷

Screenshot 2026-08-07 152153 Screenshot 2026-08-07 152254

Checklist ✅

  • I have run and tested my changes locally
  • I have limit this PR to less than 1000 lines of code change (if not, explain why)
  • I have updated/added tests to cover my changes (if applicable)
  • I have updated/added requirements to cover my changes (if applicable)
  • I have run linting and formatting on any code changes (if applicable)
  • I have updated the documentation (README, etc.) accordingly
  • I have reviewed and resolved any merge conflict

🤖 Generated with Claude Code

iabaako and others added 10 commits August 5, 2026 14:26
Prep reapply-all previously let a failing step raise uncaught, crashing
the page (e.g. a re-import that drops a column an earlier step used).
Correction reapply-all silently swallowed failures with a bare except.
Both now collect per-item failures, skip just the failing item, keep
applying the rest, and surface one shared st.warning at the UI boundary,
matching the existing pattern for interactive single-item actions.

Closes #253

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…rt' and 'import from''

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
@iabaako
iabaako marked this pull request as ready for review August 7, 2026 15:47
@iabaako
iabaako requested a review from a team as a code owner August 7, 2026 15:47
@iabaako
iabaako force-pushed the fix/253-standardize-reapply-error-handling branch 2 times, most recently from 7bfc8c7 to 9bac37d Compare August 17, 2026 12:52
@sonarqubecloud

Copy link
Copy Markdown

@iabaako
iabaako merged commit 4707457 into fix/253-standardize-reapply-error-handling Aug 18, 2026
4 checks passed
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.

2 participants