Share-link generation and med math on request
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 34s

- Visitors of class and exam links can generate NCLEX-style quizzes (default
  and maximum 50 questions, 25% select-all, Python-checked, optional 5 med
  math questions) and flashcard sets from chosen class materials, once the
  owner turns it on for the link.
- 4 quizzes and 2 flashcard sets per link per day; failed attempts do not
  count; "Reset limits" in the share dialog gives a fresh allowance.
- Sets are drafts tied to the link (migration 7): listed for every visitor,
  explainable, kept off the owner's drafts list, and reviewable or savable
  from the share dialog.
- Generate gains "Include med math" with a count (default 5): exactly that
  many dosage calculation questions at the chosen difficulty, spread through
  the quiz, even when the material has none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-15 22:04:08 -07:00
parent 25bc03ea75
commit e945f589ce
16 changed files with 807 additions and 44 deletions

View file

@ -440,6 +440,16 @@ UPDATE ai_providers SET
WHERE kind = 'ollama';
`;
/**
* Quizzes and flashcards that share-link visitors generate are drafts tied to the link (kept
* until the owner discards them or deletes the link); the daily allowance can be reset.
*/
const shareGeneration = `
ALTER TABLE drafts ADD COLUMN share_id TEXT REFERENCES shares(id) ON DELETE CASCADE;
CREATE INDEX drafts_share ON drafts(share_id, created_at);
ALTER TABLE shares ADD COLUMN generate_reset_at INTEGER;
`;
export const MIGRATIONS: Migration[] = [
{ id: 1, name: 'init', sql: init },
{ id: 2, name: 'embeddings', sql: embeddings },
@ -447,4 +457,5 @@ export const MIGRATIONS: Migration[] = [
{ id: 4, name: 'revision2', sql: revision2 },
{ id: 5, name: 'revision3', sql: revision3 },
{ id: 6, name: 'revision4', sql: revision4 },
{ id: 7, name: 'share-generation', sql: shareGeneration },
];