Skip to content

Permitir sobrescribir has_exam desde subject_overrides#1160

Merged
santiagorodriguez96 merged 1 commit into
masterfrom
sr--override-subject-has-exam
Jul 13, 2026
Merged

Permitir sobrescribir has_exam desde subject_overrides#1160
santiagorodriguez96 merged 1 commit into
masterfrom
sr--override-subject-has-exam

Conversation

@santiagorodriguez96

@santiagorodriguez96 santiagorodriguez96 commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Motivación

Al correr la tarea load_yaml estábamos obteniendo el siguiente error:

RuntimeError: Subject 1511 no longer has an exam
app/services/yml_loader.rb:99 in block in YmlLoader#load_subjects
app/services/yml_loader.rb:67 in Hash#each
app/services/yml_loader.rb:67 in YmlLoader#load_subjects
app/services/yml_loader.rb:47 in block in YmlLoader#load_degree_plans
app/services/yml_loader.rb:41 in Array#each

Causa

El scraper detecta que una materia tiene examen de dos formas: normalmente, Bedelías lista el examen como una entrada propia dentro del sistema de previaturas (con sus propias previaturas); o como fallback, si la materia no aparece en la lista, cuando otra materia declara el examen de esa materia como previatura.

1511 - SISTEMAS OPERATIVOS está inactiva, por lo que Bedelías no lista sus previaturas y el camino normal nunca se ejecuta. Su examen solo se conocía a través del fallback, gracias a que 1537 - SISTEMAS OPERATIVOS necesitaba el examen de 1511. Cuando 1537 cambió esa previatura del examen a un all sobre 1511, el fallback también dejó de aplicar, por lo que scraped_subjects.yml ahora reporta has_exam: false.

Como el examen creado previamente seguía existiendo en la base, la carga levantaba el error Subject 1511 no longer has an exam.

Solución

Agregamos soporte para sobrescribir has_exam desde subject_overrides.yml.
El loader ahora toma el valor del override cuando está presente y, si no, cae al valor scrapeado:

has_exam = subject_overrides.fetch('has_exam', subject["has_exam"])

Y forzamos has_exam: true para 1511 en db/data/computacion/1997/subject_overrides.yml. Como el archivo de overrides no lo genera el scraper, esto es robusto ante que el scraper vuelva a generar el valor como false.

The scraper detects that a subject has an exam in two ways: normally,
Bedelias lists the exam itself in the prerequisites system (with its own
prerequisites); as a fallback, the scraper also infers it when another
subject lists that subject's exam as a prerequisite.

`1511 - SISTEMAS OPERATIVOS` is inactive, so Bedelias does not list its
prerequisites and the normal path never fires. Its exam was only known
through the fallback, via `1537 - SISTEMAS OPERATIVOS` needing `1511`'s
exam. When `1537` switched that prerequisite from the exam to an `all`
over `1511`, the fallback stopped firing too, so `scraped_subjects.yml`
now reports `has_exam: false`. Loading the yml then raised "Subject 1511 no
longer has an exam" because the previously-created exam still existed.

Let `subject_overrides.yml` override `has_exam` (falling back to the
scraped value when absent) and force `has_exam: true` for `1511`, which
is robust to the scraper regenerating the value as false.
@santiagorodriguez96
santiagorodriguez96 force-pushed the sr--override-subject-has-exam branch from ebf34d4 to 787f30a Compare July 13, 2026 19:10
@santiagorodriguez96
santiagorodriguez96 merged commit 52ce537 into master Jul 13, 2026
5 checks passed
@santiagorodriguez96
santiagorodriguez96 deleted the sr--override-subject-has-exam branch July 13, 2026 19:53
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