Repository navigation
fix: read the contest's own problems and teams, not the 2017 tables (#106) - #107
Merged
Merged
Conversation
…106) Closes #106. Two screens read `exercises` and `teams`, the Helium tables from 2017. A contest created through the wizard writes to `problems` and `users` and never touches them. The dashboard counted both, while the submission counts right below came from `runs`. On any real contest it showed "0 problems, 0 teams, N submissions" -- four headline numbers side by side, two of them contradicting the other two. All four are now scoped to one contest: the viewer's own if they have one, otherwise the running competition, never the practice contest (#43). Worse, the clarification form's problem dropdown was filled from `exercises`, so it was always empty and a team could only ever ask a "Geral" clarification, never one about a problem. It now lists the contest's problems by letter and name, the listing shows that label instead of "Problema #7", and a posted problem_id is checked against the contest before it is stored -- clarifications.problem_id is a foreign key to `problems`, so an id from anywhere had no business reaching it. A third bug fell out of writing the test. home.blade.php renders `$submission->time . 's'` in its "Tempo" column and nothing ever selected a `time`: the dashboard threw "Undefined property: stdClass::$time" the moment a contest had its first submission. No test had ever loaded it with a run in the database. It now reports the judged duration, and there is a test that loads the dashboard with a judged submission. Three existing tests were asserting the old behaviour -- seeding `exercises`/`teams` and checking the dashboard counted them, and expecting an `exercises` key in the clarification view. They assert the real tables now. SiteController::teams() already did this correctly, which is where the query shape came from. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Pvf2R8xtgbWQm1wRvjBqQY
This was referenced Sep 13, 2026
matbrgz
added a commit
that referenced
this pull request
Sep 13, 2026
…ads (#99) (#111) Closes #99. /backend/teams sat in the main admin sidebar and read `DB::table('teams')`, the Helium table from 2017 -- team_id, teamName, score. The contest's actual teams are rows in `users` with user_type='team', which is what SubmitController, Leaderboard, Score, BocaWebcastZipBuilder and the ICPC report all use. After #107 removed the other two readers, the audit was unambiguous: `exercises` has no reader or writer left anywhere, and `teams` had exactly one consumer -- this screen, which read, wrote and deleted its own table while nothing else ever looked at what it wrote. Not a screen that had fallen out of date; a closed loop that was never connected to anything. Both reference implementations model this the same way, and neither the way this screen did: BOCA has one usertable and one admin/user.php; a team is a user with type='team'. There is no teams table and no teams screen. CD-MOJ's source of truth is contests/<id>/users/<login>/, one directory per account. It does have a "Times" screen, but read what it is: "Identidade de cada conta no placar: nome do time, país/bandeira, sede, universidade, brasão e foto" -- presentation metadata hanging off accounts, with the roster in a separate "Inscrições" screen. So the menu slot is worth having eventually; what occupied it was not it. #105 gave account editing a real home in /backend/users, and /site/teams already lists a site's real teams. The four legacy tables (teams, exercises, exercise_team, team_user) are deliberately left in place. Dropping them is irreversible and I cannot verify from here whether anything outside this repository reads that database -- an old report, an operations script. The screen is the part that was actively misleading, and removing it changes no data. Claude-Session: https://claude.ai/code/session_01Pvf2R8xtgbWQm1wRvjBqQY Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fecha a #106.
Duas telas liam
exerciseseteams, as tabelas Helium de 2017. Um concurso criado pelo assistente escreve emproblemseuserse nunca encosta nelas.O painel contradizia a si mesmo
Ele contava as duas legadas, enquanto as contagens de submissão logo abaixo vinham de
runs. Em qualquer competição real isso exibia "0 problemas, 0 times, N submissões" — quatro números de destaque lado a lado, dois deles desmentindo os outros dois.Agora os quatro são escopados a um concurso: o do próprio espectador quando ele tem um, senão a competição em andamento, e nunca o Treino Livre (#43).
Pior: a equipe não conseguia abrir esclarecimento sobre um problema
O seletor do formulário vinha de
exercises, então estava sempre vazio — "Geral" era a única coisa que dava para perguntar. Agora lista os problemas do concurso por letra e nome, a listagem mostra esse rótulo em vez deProblema #7, e oproblem_idenviado é conferido contra o concurso antes de ser gravado —clarifications.problem_idtem FK paraproblems, então id vindo de qualquer lugar não tinha o que fazer ali.Um terceiro bug caiu no colo ao escrever o teste
O
home.blade.phprenderiza$submission->time . 's'na coluna "Tempo", e nada nunca selecionou umtime: o painel estouravaUndefined property: stdClass::$timeassim que a competição tinha a primeira submissão. Nenhum teste jamais tinha carregado aquela página com uma run no banco.Agora reporta a duração do julgamento, e existe um teste que carrega o painel com submissão julgada.
Três testes existentes afirmavam o comportamento errado
Semeavam
exercises/teamse conferiam que o painel os contava, e esperavam a chaveexercisesna view de esclarecimentos. Passam a aferir as tabelas reais.O
SiteController::teams()já fazia isso certo — foi de lá que veio a forma da consulta.Suíte: 797 verdes.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Pvf2R8xtgbWQm1wRvjBqQY