Retire duplicate statistics display helper through the pinned coursework API
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Refactorización
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- backend, ci-cd, testing-qa
Línea de trabajo
Read the listed course, security, verification, architecture and CI specifications, then inspect courses/models/stat_display.py, the imports and calls in courses/models/homework.py and project.py, and the project_statistics view. Review the released community_base coursework helper and add courses/tests/test_statistics_display_contract.py with the specified gate enrollment. Done means the duplicate module is deleted, callers use the public helper, existing behavior tests pass, and the required verification evidence is complete.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Retire duplicate statistics display through the pinned coursework API
Status: groomed; ready for isolated local implementation
Area: courses
Priority: P1
Type: enhancement
Depends on: no new package capability or release; the current immutable pin supplies the public helper.
Goal and normative references
Remove the 158-line site statistics-display helper without changing learner or staff behavior, visible pages, or the current database and course model contracts.
Read first:
_docs/specs/04-courses-and-cohorts.md: preserve homework/project statistics and characterize before structural changes._docs/specs/07-security-privacy-operations.md,_docs/specs/10-verification-strategy.md, and_docs/architecture/app-boundaries.mdat the implementation base._docs/PROCESS.mdand_docs/ci/change-selective-ci.md: role separation, versioned verification, browser impact and delivery.- Current protected coding authority
/home/alexey/git/dtc-website/coding-standard.md, read-only even when absent from the isolated implementation base. - Released public
community_base.coursework.stat_display, already installed throughv0.5.10at commit4c692db461f4c7cbbc2f60afaa05162987a640f6.
The audit establishes source-derived equivalence and caller reachability, not runtime parity. No dependency bump, package edit, tag, or local/path/branch install is needed. D5.1/#414 model adoption, C5.3 and package PR402 are not dependencies of this object-taking pure helper.
Exact scope and ownership
Use an isolated issue worktree based on committed 106c777d2cd39666afb5f0990c7301fe5ad418c3. Root assigned this new concern only; shared main and foreign work remain protected.
Production writes are limited to:
- Delete
courses/models/stat_display.py. - In
courses/models/homework.py, replace its helper import and qualify the existing calls inHomeworkStatistics.get_stat_fields. - In
courses/models/project.py, replace its helper import and qualify the existing calls inProjectStatistics.get_stat_fields. - In
courses/views/project_statistics.py, retarget the direct import tofrom community_base.coursework.stat_display import project_stat_sections, preserving the entireproject_statistics_sectionsfunction byte-for-byte. It is already 33 lines; this import-only seam avoids materially changing or growing that oversized function.
In the two model files use the package public module directly, for example from community_base.coursework import stat_display as display, after checking alias collisions. The view uses the direct public symbol import above; no forwarding wrapper is added. No facade, forwarding function, second section builder or copied helper remains. Preserve the existing site get_value, view loop and all other methods.
Test writes are limited to a new cohesive courses/tests/test_statistics_display_contract.py for missing authoritative coverage. Existing model/view tests are read and executed; editing them requires a separate exact allocation. Ignored issue evidence belongs under .tmp/.
Required gate enrollment (narrow scope amendment)
At the committed base, the new test and the existing relevant statistics test modules are excluded from the adoption lint/format/type opt-ins. Moving coverage into an unrelated opted-in test is not an alternative to enrolling its actual owner. Root approved these additional metadata slices before any source edits:
scripts/ci.py: add onlycourses/tests/test_statistics_display_contract.pyas one literal entry in the existingADOPTION_INTEGRATION_PYTHONcatalog.pyproject.toml: add onlycourses.tests.test_statistics_display_contractto the existing strict module override. Dependency, package source and every other setting remain unchanged.core/tests/test_deployment_workflow.py: update onlySTUDIO_COURSES_PYPROJECT_SHA256to the actual final pyproject bytes and add the issue #453 configuration-only history annotation, following the existing reviewed seal procedure.SECURITY_REMEDIATED_UV_LOCK_SHA256and all other Gate B inputs and assertions remain unchanged.
No pin, lock, other seal, assertion, regex, exclusion, baseline, command or workflow change is allocated. These owners must recognize and enforce the new cohesive test; no ignored or skipped new coverage is acceptable.
Coding-standard tool/cohesion exception, only if physical file growth occurs: the canonical CI registry's one required literal entry and the existing seal metadata/history annotation may grow their oversized tool-owned files by those exact entries. Keeping enrollment in the canonical registry and recording the actual reviewed seal in its established owner is necessary to enforce the test without creating a parallel catalog or weakening the gates. This permits no function-body growth, business-code growth, unrelated entries or broad oversized-file waiver. Registry extraction is separate work. The two model files still must not grow after actual Ruff formatting; the existing 33-line view function stays byte-identical. The new test remains at most 300 lines with new/materially changed handwritten functions at most 30.
The engineer recomputes the final native verification plan after these final configuration bytes, runs the selected coverage and strict new-test gates, and retains the owning Gate B checks and negative synthetic-unreviewed-drift proof. No prior success is borrowed across changed inputs without a valid exact evidence envelope.
The three imports and whole named methods are byte-identical across the committed base and protected coding commits b92d674, 1056d506 and shared e9d0cdd. Foreign Question.clean, unrelated view redirect/render changes, coding guidance, advisory configuration, and #425 template WIP remain untouched, unintegrated and unreleased. Same-file presence is not ownership of those unrelated slices. Preserve this boundary during eventual integration; never replace whole files with donor copies or reset shared main.
Preserved contract
The public package owner exports StatRow, StatSection, STAT_ROWS, section builders and build_stat_fields; the selected functions construct display values using the supplied site's stats.get_value(field_name, stats_type). They require no package model or manager query.
- Homework sections remain questions score, total score, lecture time, homework time, and learning-in-public score, in that order.
- Project sections remain project score, project learning-in-public score, peer-review score, peer-review learning-in-public score, total score, and time spent, in that order.
- Model display rows remain
min,max,avg,q1,median,q3, with exact current labels and icons. The result remains a list of(section_label, rows, section_icon)tuples containing(value, row_label, row_icon)tuples. - Preserve all
None, zero, positive and nonintegral values without filtering, normalization, rounding or type changes. The current site'sget_valueremains authoritative. - Preserve the project view's distinct range-card shape and ordering, including
has_data, positions, equal-range behavior, empty data, and time-field handling. Do not replace that view shaping loop with the model tuple builder. - Preserve existing access, cohort isolation, incomplete-project response, errors, routes, templates, assets and visible controls.
Non-goals
No model, field, ORM query, schema, migration, data rewrite, history, calculation, score, cache, transaction, permission, route, API or template change. No package pin, lock, source-policy, lock seal, other Gate B contracts, graph, workflow, coding guidance or advisory-policy change. The precisely reviewed test enrollment and configuration-only pyproject seal update below are the sole metadata changes. No production data or provider access.
#439 remains frozen under its existing #438/#440 operational hold. Homework scoring/#55, FAQ and learning-in-public persistence, batch scoring, statistics calculation, review, enrollment, Wrapped and rubric-validator adoption remain outside this issue. Do not weaken those holds or count their deletion estimates here.
Acceptance criteria
- Before and after deletion, inventory direct, relative, parent/dotted and aliased imports, scripts, tests, attributes, patch targets and dynamic strings. No reference to the deleted site module remains; callers use the released public owner directly.
- Add any materially missing behavior coverage first and prove it passes on unchanged source. On actual DTC
HomeworkStatisticsandProjectStatisticsinstances, assert complete ordered output, every section/row label and icon, tuple/list shape, andNone, zero, positive and nonintegral values. Independent expected values must not be obtained from the replacement helper itself. - The same owning tests pass after deletion. Existing project-model, homework-dashboard/question-statistics and rendered project-statistics tests pass. Public context retains range-card behavior and the existing incomplete/denial/cohort boundaries.
- A narrow output mutation, such as reordered sections/rows or omitted zero/null data, fails the owning behavior assertion rather than setup. Restore exact final bytes and retain the red control evidence; no broad mutation matrix is required.
- The module is deleted with no facade or parallel implementation. Report actual gross and net production lines separately from test lines; target 158 net production lines using replacements within existing line allocations. No unrelated removal is used to reach the target.
- After actual Ruff formatting, neither oversized model file nor its changed function grows; materially changed handwritten functions are at most 30 lines and new cohesive files at most 300. A collision-checked direct module alias is acceptable when it avoids wrapping. No fragment or growth waiver.
- All excluded source, model/schema, routes/templates, package pin/lock/source-policy, lock seal, other Gate B contracts, foreign coding changes and stored history remain unchanged. Only the exact new-test opt-in/strict entry and final pyproject seal/history annotation change; gate coverage synchronizes the entries and still rejects unreviewed pyproject drift.
- The engineer generates and passes the exact versioned verification plan, run, evidence-check and report-check, recording base/candidate, graph/plan/environment/input digests, actual commands/counts and all four component dispositions. Required quality/lint/advisory/type/migration-drift and browser tiers follow the current graph without overrides or baseline exemptions.
- A distinct Tester independently recomputes the frozen plan, validates any reuse, executes required components and checks each criterion. Required desktop/mobile screenshots are independently captured and inspected when the graph selects render impact; otherwise use its backend browser tier and explicit not-applicable screenshot disposition. PM accepts only afterward.
- After both reviews, the engineer makes a focused commit; root integrates and pushes through the native DTC process, and sole OnCall proves all required CI and development gates green. Local capability parity does not waive actual operational gates or close the issue early.
Verification scenarios
Complete display before and after
Given actual site statistics instances contain distinct values for every section/distribution field, including missing and zero values, their display methods return exactly the current complete tuples, labels, icons and order before and after the import change. A deliberately broken ordering or omission must fail this assertion.
Learner statistics and safe denial
A synthetic permitted learner visits the current completed-project statistics destination and sees unchanged range cards and values. An incomplete project retains its current response. Existing unauthorized and cross-cohort cases retain their current denial; this issue adds no new access rule or page.
Verification and delivery
Use synthetic isolated SQLite/provider-free fixtures. Relevant existing tests include test_project_statistics_model.py, test_dashboard_homework_stats.py, test_homework_question_stats.py, and project-statistics view/integration tests. Select exact final commands from the actual impact graph rather than promising counts in advance.
Generate with uv run --frozen python scripts/ci.py verification-plan, execute verification-run, then verification-evidence-check and verification-report-check. Blocking lint is uv run --frozen python scripts/ci.py lint; apply current coding advisory guidance read-only. The separate Tester uses the role-specific plan/run contract. Backend smoke is the minimum; a view import edit does not authorize a manual screenshot waiver. Unknown impact follows the graph's full fallback.
The dedicated engineer leaves the candidate uncommitted and frozen with its own issue report. Tester and PM reports remain independent. DTC uses local no-ff integration and no pull request. Sole OnCall observes post-push CI/development; no agent uses package comparison exceptions as native site green.
- Lenguaje dominante
- Python
- Estrellas
- 0
- Forks
- 0
- Merge medio
- 1 min
- PR fusionados (30 d)
- 2
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de DataTalksClub/website
-
bug infra operations P1 testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
DataTalksClub/website#329 ·
-
bug content data-migration documentation events operations P1
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
DataTalksClub/website#327 ·
-
bug frontend P0 testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
DataTalksClub/website#300 · 7 comentarios ·
-
bug data-migration events P0 testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
DataTalksClub/website#295 · 6 comentarios ·
-
bug infra operations P1
Dificultad 4/5 1-2 días Aptitud para principiantes 25/100
DataTalksClub/website#474 · 4 comentarios ·
Todos los issues de DataTalksClub/website
Issues similares
-
Import errors are swallowed: PerthImplicitWatermarker silently becomes NonePosiblemente ocupada @JonRC la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
resemble-ai/Perth#23 ·
-
correction metadata
Dificultad 2/5 Menos de una hora Aptitud para principiantes 65/100
acl-org/acl-anthology#10753 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
earthtojake/text-to-cad#758 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 70/100
DataTalksClub/faq#545 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día