Skip to content

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

Open
iabaako wants to merge 3 commits into
fix/253-standardize-reapply-error-handlingfrom
feat/correction-log-show-survey-id
Open

feat: show Survey ID on the Correct Data page and in the Correction Log#264
iabaako wants to merge 3 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

@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2026

Copy link
Copy Markdown

@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
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.

1 participant