ENGLISH·COURSE API
    Preparing search index...
    • Reads the prize of a single module from this device: which toy it is, its state and how many of its tickets are earned.

      Parameters

      • __namedParameters: {
            course: {
                id: string & $brand<"CourseId">;
                slug: string & $brand<"Slug">;
                title: string;
                description: string;
                language: string;
                lessonCount: number;
                moduleCount: number;
                sequence: number;
                track: "level" | "reference";
                outcomes?: string[];
                audience?: string;
                highlights?: string[];
                sounds?: { vowels: string[]; consonants: string[] };
                translations?: Record<
                    string,
                    {
                        description?: string;
                        outcomes?: string[];
                        audience?: string;
                        highlights?: string[];
                    },
                >;
            };
            module: {
                id: string & $brand<"ModuleId">;
                courseId: string & $brand<"CourseId">;
                slug: string & $brand<"Slug">;
                title: string;
                sequence: number;
            };
            lessons: readonly (
                | {
                    kind: "reading";
                    id: string & $brand<"LessonId">;
                    courseId: string & $brand<"CourseId">;
                    moduleId: string & $brand<"ModuleId">;
                    sequence: number;
                    title: string;
                    body: string;
                }
                | {
                    kind: "video";
                    id: string & $brand<"LessonId">;
                    courseId: string & $brand<"CourseId">;
                    moduleId: string & $brand<"ModuleId">;
                    sequence: number;
                    title: string;
                    description: string;
                    source: string;
                    durationSeconds: number;
                    poster?: string;
                    uploadDate?: string;
                }
            )[];
        }

      Returns ModulePrizeReading

      The module's prize reading, or { hasPrize: false } for a module with no lessons

      It is the Achievements counter's own reading, narrowed to one module, so a page showing the prize can never disagree with the counter: tickets stay earned after an un-mark, and a claim stays claimed. Like the counter, reading it records the tickets of lessons that were complete before tickets were stored.

      On the server, and before storage has been read, every store is empty, so the reading is locked with no tickets — callers that must not assert progress wait for their own "read" signal before showing it.

      const prize = useModulePrize({ course, module, lessons });
      if (prize.hasPrize) console.log(prize.state, prize.ticketsEarned, prize.ticketCount);