Build log · Software & apps

Save My Spells — 16 subjects, 182 exam questions, one offline file

Software & appsdone4 versionssingle file16 subjects182 questions · 461 marksoffline19 SVG figures

✅ reflection written · every fact below is generated from this project’s own spec and files

What it is

A revision site for the Hogwarts curriculum in the shape of the ones we actually revise from: 16 subjects, 71 topic pages, 182 exam questions and 461 marks of point-by-point mark schemes, plus flashcards, a paper generator that stratifies its draw and times itself, a redo pile that empties as you fix it, and a ranking of what to revise next. One file, no network request, and every figure drawn as inline SVG.

Version history

Straight from the project’s own card data — what each version added.

V4

Revise next: per-subject score out of 100 with reason lines and a five-question drill; drill papers enter the pile like any other.

V3

Paper generator: stratified draw, absolute deadline, self-marking, last 20 papers, two print outputs.

V2

16 subjects, 71 topics, 182 questions, 461 marks; 325 key terms; seven electives added.

V1

Nine core subjects, 40 topics, 120 questions, 293 marks.

By the numbers

Measured from the real working folder ~/Documents/save-my-spells/ — not a claim, a count.

32
files
6,021
lines of code
4
file types used
2026-11-26
oldest file
2026-11-30
last touched

Mostly: Python ×19 · binary assets ×11 · Markdown ×1 · HTML ×1

Full analysis

The rule that shaped everything

"Single self-contained offline HTML file; images must be inline SVG or data URIs, with no external requests." That one sentence removed every easy option: no icon library, no chart library, no image files, no fonts. The 19 teaching figures and 16 subject emblems had to be drawn from SVG primitives by hand, which sounds like an art problem and turned out to be a layout problem — a label in the wrong place is a wrong fact.

The test that was wrong, not the app

The paper generator was working and the suite said 28 out of 30. The marking loop clicked one button and then read a different number, so the app was right and my assertion was nonsense. That is still the most useful failure in the project, because it produced the paper suite: 42 assertions that mark a whole paper end to end, save it, reload it and compare the total — instead of trusting the page to add up because it looks right.

The pile test then failed a second way, and the app was innocent again. A five-question drill draws randomly from the subject, so "marking the drill full drains five pile entries" asserted something the draw cannot guarantee — if the drill happened not to include the pile questions, nothing drains. The fix was to seed the pile with every question in the subject so any five-question drill must overlap it. Randomness makes a test lie in both directions: it can pass by luck and fail by luck.

Canon errors that would have cost marks

Three passes corrected real mistakes, all of them the kind that read as correct:

  • Dragon blood uses. Twelve, according to Dumbledore's discovery — and the note listed a use that belongs to a different substance.
  • Nifflers. They are not thieves with judgement; they are drawn to shiny things, which is why they are useless as guards and useful as detectors.
  • Horcruxes. The figure caption said six objects. Voldemort planned six and kept one piece in his body, which is seven soul pieces and six objects, Nagini being the last object made. Harry was the accidental one. The first version's arithmetic was wrong in a way that would have cost a two-mark question.

The Horcrux plate is also where the art checker earned its place: one caption was crossing a second caption, which looks like two lines of text until you read it as one sentence.

Mobile was broken in a way screenshots hide

At 320 px the page scrolled sideways. A figure SVG wider than the viewport forced the main column wider, so the whole page inherited the scroll — and in a laptop screenshot it looks perfect. The fix is two lines (.figscroll{overflow:hidden} and main{min-width:0}), but the value is the assertion: 320 px and 390 px now fail with a number, 562 vs 320, instead of being noticed by accident.

A clock that cannot be paused by leaving

The obvious build stores the time remaining and decrements it on a tick, which means the paper waits while you are in another tab. Storing an absolute deadline instead makes the rule structural: the remaining time is always the deadline minus now, and the paper's own length decides the limit (marks × 1.5 minutes, rounded to five), so the clock and the questions cannot disagree.

Revise next: the number had to explain itself

A ranking with no reasons is a horoscope. The first version printed "nothing answered yet" next to a subject that had questions in the redo pile, because the reason strings and the score were built from two different sets of data. It now builds the reasons from the same numbers that produced the score, and the three terms are capped at 40, 35 and 25 so no single signal can own the ranking.

What I would change

The content is the slow part, not the code. Fifteen modules of prose came out at 19,675 words, and every canon pass cost an hour because one fact lives in three places: the note, the mark scheme, and the figure caption. Fixing the Horcrux count meant editing the note and the plate and checking the schemes against both. If I built it again I would put the facts in one table and render notes and schemes from it, so a correction happens once.

The second thing: a seven-day plan. The ranking answers "what now" and then stops. With the pile, accuracy and opened topics already in state, a scheduler is a small build on data that exists — and it is the thing I would actually use the night before a paper.

Build spec

The project’s own build notes, rendered. Open the raw .md ↗

Show the spec

Build spec — Save My Spells

Artifact: demos/save-my-spells/index.html (single file, 396,175 bytes, sha256 60fe0441…21f098) Mirror: demos/save-my-spells-mirror/index.html (byte-identical copy) Analysis: demos/save-my-spells-analysis.html Source: ~/Documents/save-my-spells/ (parts_a.py–parts_g.py, art.py, fig_a.py, fig_b.py, template.html, build.py, verify.py, verify_paper.py, verify_revise.py, artcheck.py)

What it is

One offline HTML revision site for the Hogwarts curriculum, shaped like Save My Exams: 16 subjects, 71 topic pages, 182 exam questions and 461 marks of point-by-point mark schemes, plus flashcards, a paper generator, a redo pile and a "revise next" ranking. No network requests, no image files, no fonts — every figure and emblem is inline SVG assembled from primitives.

Hard requirements (do not regress these)

  1. One file, no requests. The only http:// string in the output is the SVG namespace. Images are
  2. inline SVG only. Opens from the Desktop with Wi-Fi off.

  3. The build refuses rather than warns. build.py exits non-zero if a topic has fewer than 3 key
  4. terms or fewer than 2 questions, a question has an empty scheme or zero marks, a level is not O.W.L. or N.E.W.T., a subject has no emblem, a fig key is unregistered, or two topics share an id.

  5. Book canon, and silence labelled. Where the books do not say, the note says so instead of inventing.
  6. Film-only material carries a film label. The 1993 Statute of Secrecy pass, dragon-blood uses, Niffler behaviour and the Horcrux count were each corrected against the books during the build.

  7. Progress in localStorage under sms.v1, wrapped in try/catch so a blocked store degrades to
  8. session-only instead of breaking the page.

  9. Mobile at 320 px and print both clean. Figures sit in .figscroll with main{min-width:0} so a wide
  10. SVG scrolls inside its own box rather than pushing the page sideways.

Content shape

Subject → topics → notes (blocks of p / ul / table with an h heading), terms (≥3), tip, traps, and q (≥2 questions with marks, q, ms). 47 topics are O.W.L. level, 24 are N.E.W.T.

Features

  • Paper generator: tier (mixed / O.W.L. / N.E.W.T.), 10–30 questions, one subject or all, timed or not.
  • Draw is round-robin over shuffled subjects so a 30-question paper cannot come from two subjects. The clock stores an absolute deadline (leaving the page does not pause it); time is marks × 1.5 minutes rounded to 5.

  • Self-marking: full / half / missed against the real scheme. Full marks add house points; half and
  • missed enter the redo pile.

  • Redo pile: miss counts increment, marking the same question full later removes it, redo papers take up
  • to 10 most-missed-first then shuffle.

  • Revise next: per-subject score out of 100 = min(40, pile marks × 4) + unopened share × 35 + (1 −
  • accuracy) × 25 (flat 12 when nothing is marked), with a Practise drill of 5 questions.

  • Print: Print paper (questions only, name/date lines) and Print with marks (answer key, mark
  • buttons stripped).

Regenerating

cd ~/Documents/save-my-spells
python3 artcheck.py        # figures=19 labels=210 issues=0
python3 build.py           # OK ~/Documents/SaveMySpells.html
python3 verify.py          # 51 assertions
python3 verify_paper.py    # 42 assertions
python3 verify_revise.py   # 20 assertions
cp ~/Documents/SaveMySpells.html ~/Desktop/desktop/portfolio-deploy/demos/save-my-spells/index.html
cp ~/Documents/SaveMySpells.html ~/Desktop/desktop/portfolio-deploy/demos/save-my-spells-mirror/index.html

/demos/save-my-spells and /demos/save-my-spells-mirror are in SKIP_PREFIX in ~/scripts/theme-inject.py, so the served bytes stay identical to the source (no skin block, no floating theme button over the paper timer). Verify by sha-256, not by eye.