Banner
Add a concise subheading about your product or business to your students.
Add a concise subheading about your product or business to your students.
| <!-- ===================================================================== |
| PERSONALIZED PD PATHWAY — QUIZ WIDGET |
| Paste this into a Thinkific custom page (theme code / HTML block). |
| Set the page to "private" so only logged-in users can reach it. |
| Fill in the three CONFIG blocks marked TODO, then add your BACKEND_URL. |
| ===================================================================== --> |
| <!-- 1) LOGGED-IN USER (Liquid). |
| This only renders if the page is processed through Thinkific's theme/Liquid. |
| If you see literal {{ }} on the page, you're in a non-Liquid block — move the |
| widget into a theme template, or collect the email from a confirmation field. --> |
| <script> |
| window.THINKIFIC_USER = { |
| id: "{{ site.current_user.id }}", |
| email: "{{ site.current_user.email }}", |
| name: "{{ site.current_user.first_name }} {{ site.current_user.last_name }}" |
| }; |
| // Fallback for previewing this file outside Thinkific: |
| if (!window.THINKIFIC_USER.id || window.THINKIFIC_USER.id.indexOf("{{") === 0) { |
| window.THINKIFIC_USER = { id: "PREVIEW", email: "[email protected]", name: "Preview Teacher" }; |
| } |
| // 2) COMPLETED COURSES (phase 2 — exclude classes the teacher already finished). |
| // Leave empty for now. Later, populate from Liquid or a backend call. |
| // Values are Thinkific COURSE IDs as strings. |
| window.COMPLETED_COURSE_IDS = [ |
| // "123456", "234567" |
| ]; |
| </script> |
| <div id="pd-quiz"></div> |
| <style> |
| #pd-quiz { max-width: 720px; margin: 0 auto; font-size: 16px; line-height: 1.6; } |
| #pd-quiz h2 { font-size: 22px; font-weight: 600; margin: 0 0 8px; } |
| #pd-quiz .sub { color: #555; margin: 0 0 24px; } |
| #pd-quiz .q { padding: 16px 0; border-bottom: 1px solid #e5e5e5; } |
| #pd-quiz .q p { margin: 0 0 10px; font-weight: 500; } |
| #pd-quiz .scale { display: flex; gap: 6px; flex-wrap: wrap; } |
| #pd-quiz .scale label { flex: 1; min-width: 64px; text-align: center; padding: 8px 4px; |
| border: 1px solid #ccc; border-radius: 8px; cursor: pointer; font-size: 13px; } |
| #pd-quiz .scale input { display: none; } |
| #pd-quiz .scale input:checked + span { font-weight: 600; } |
| #pd-quiz .scale label:has(input:checked) { border-color: #0F6E56; background: #E1F5EE; } |
| #pd-quiz .field { margin: 0 0 24px; } |
| #pd-quiz select, #pd-quiz button { font-size: 16px; padding: 10px 14px; border-radius: 8px; } |
| #pd-quiz select { border: 1px solid #ccc; width: 100%; max-width: 320px; } |
| #pd-quiz button { background: #0F6E56; color: #fff; border: 0; cursor: pointer; margin-top: 24px; } |
| #pd-quiz button:disabled { opacity: .5; cursor: default; } |
| #pd-quiz .plan-domain { margin: 20px 0 8px; font-weight: 600; } |
| #pd-quiz .plan-course { padding: 10px 14px; border: 1px solid #e5e5e5; border-radius: 8px; margin: 6px 0; } |
| #pd-quiz .err { color: #A32D2D; } |
| </style> |
| <script> |
| (function () { |
| "use strict"; |
| /* ===================================================================== |
| CONFIG A — GRADE LEVELS (populated from your class list) |
| ===================================================================== */ |
| var GRADE_LEVELS = [ |
| { key: "ec", label: "Early Childhood" }, |
| { key: "le", label: "Lower Elementary" }, |
| { key: "ue", label: "Upper Elementary" }, |
| { key: "hs", label: "High School" } |
| ]; |
| /* ===================================================================== |
| CONFIG B — QUESTIONS |
| Three per domain. `level` is "basic", "intermediate", or "advanced". |
| Do NOT change the `domain` keys — the engine relies on them. |
| ===================================================================== */ |
| var DOMAINS = { |
| instruction: "Instruction", |
| planning: "Planning", |
| classroom: "Classroom Environment", |
| wholechild: "The Whole Child" |
| }; |
| var QUESTIONS = [ |
| { domain: "instruction", level: "basic", text: "I have reliable ways to know whether every student understood, not just the ones with their hands up." }, |
| { domain: "instruction", level: "intermediate", text: "I use questioning and discussion to push students\u2019 thinking, not just to check for the right answer." }, |
| { domain: "instruction", level: "advanced", text: "When a lesson isn\u2019t landing, I can adjust on the spot to reach the students in front of me." }, |
| { domain: "planning", level: "basic", text: "My lessons are built backward from a clear picture of what students should walk away knowing." }, |
| { domain: "planning", level: "intermediate", text: "My assessments and activities line up directly with the goals I set for the lesson." }, |
| { domain: "planning", level: "advanced", text: "I plan with the range of learners in my room in mind, so the material reaches different levels." }, |
| { domain: "classroom", level: "basic", text: "My classroom runs on routines and expectations that students understand and respect." }, |
| { domain: "classroom", level: "intermediate", text: "I redirect off-task or disruptive behavior calmly, without losing the flow of the lesson." }, |
| { domain: "classroom", level: "advanced", text: "Students in my room feel safe to participate, take risks, and make mistakes." }, |
| { domain: "wholechild", level: "basic", text: "I can tell when a student\u2019s behavior is signaling something deeper \u2014 emotional, social, or at home." }, |
| { domain: "wholechild", level: "intermediate", text: "I build relationships with students that make them comfortable coming to me when something\u2019s wrong." }, |
| { domain: "wholechild", level: "advanced", text: "I know how to respond to a struggling student in a way that supports them and points toward the right help." } |
| ]; |
| /* ===================================================================== |
| CONFIG C — COURSE CATALOG (generated from your matched classes) |
| Four domains (Professional Responsibilities removed from the quiz). |
| Ordered most basic -> most advanced; within a difficulty, by rating (1 first). |
| Fill the Rating column in the sheet to control ties, then re-generate. |
| ===================================================================== */ |
| var COURSE_CATALOG = { |
| ec: { |
| instruction: [ |
| { id: 2361026, slug: "aleph-bais-in-action", rating: null, title: "Aleph Bais in Action" }, |
| { id: 2365565, slug: "Criticism-Praise-Feedback-II", rating: null, title: "Criticism, Praise & Feedback:- part I" }, |
| { id: 2365565, slug: "Criticism-Praise-Feedback-II", rating: null, title: "Criticism, Praise & Feedback:- part II" }, |
| { id: 2365834, slug: "The-Teacher-as-the-Master-Communicator", rating: null, title: "The Teacher as the Master Communicator" }, |
| { id: 2366931, slug: "Deciphering-the-Dots-in-Kriah", rating: null, title: "Deciphering the Dots in Kriah" }, |
| { id: 3434689, slug: "kabalosh-hatorah-rav-kaplan", rating: null, title: "Kabbalas Hatorah in Ourselves & in Our Talmidim" }, |
| { id: 3353509, slug: "music-and-movement-in-teaching", rating: null, title: "The Preschool Experience: Integrating Music & Movement into Everyday Teaching" }, |
| { id: 2360748, slug: "the-underachiever", rating: null, title: "The Underachiever" }, |
| { id: 3100995, slug: "aleph-plus-kriah-course", rating: null, title: "Aleph Plus Course Part I" }, |
| { id: 3162708, slug: "executive-function", rating: null, title: "Develop Executive Function Through Direct Instruction" }, |
| ], |
| planning: [ |
| { id: 2361026, slug: "aleph-bais-in-action", rating: null, title: "Aleph Bais in Action" }, |
| { id: 2550842, slug: "multi-sensory-kriah", rating: null, title: "Multi-Sensory Kriah" }, |
| { id: 2361541, slug: "preschool-by-design", rating: null, title: "Preschool by Design" }, |
| { id: 2366931, slug: "Deciphering-the-Dots-in-Kriah", rating: null, title: "Deciphering the Dots in Kriah" }, |
| { id: 3100995, slug: "aleph-plus-kriah-course", rating: null, title: "Aleph Plus Course Part I" }, |
| ], |
| classroom: [ |
| { id: 3340889, slug: "responses-to-misbehavior", rating: null, title: "Responses to Misbehavior" }, |
| { id: 2367958, slug: "awakening-greatness", rating: null, title: "Awakening Greatness" }, |
| { id: 2369215, slug: "management-without-manipulation-1", rating: null, title: "Management without Manipulation Part I" }, |
| { id: 2369216, slug: "management-without-manipulation-2", rating: null, title: "Management without Manipulation Part II" }, |
| { id: 2369698, slug: "management-without-manipulation-3", rating: null, title: "Management without Manipulation Part III" }, |
| { id: 2360985, slug: "nobody-cries-on-the-first-day", rating: null, title: "Nobody Cries on the First Day" }, |
| { id: 3217142, slug: "whatever-we-stress-we-get-more-of", rating: null, title: "Whatever We Stress We Get More Of" }, |
| ], |
| wholechild: [ |
| { id: 2363300, slug: "making-the-classroom-a-safe-home", rating: null, title: "Making the Classroom a Safe Home" }, |
| { id: 2365108, slug: "better-behavior-now", rating: null, title: "Better Behavior Now" }, |
| { id: 2366565, slug: "the-outlier", rating: null, title: "The Outlier" }, |
| { id: 2368223, slug: "A-Relationship-Prequisite-to-all-Learning", rating: null, title: "A Relationship: Prequisite to all Learning" }, |
| { id: 2360197, slug: "connect-the-dots-of-misbehavior", rating: null, title: "Connect the Dots of Misbehavior" }, |
| { id: 2366913, slug: "Demystifying-Social-Success", rating: null, title: "Demystifying Social Success" }, |
| { id: 2360223, slug: "I-Can-Solve-My-Behavioral-Challenge", rating: null, title: "I Can Solve My Behavioral Challenge" }, |
| { id: 2362064, slug: "making-it-always-1on1", rating: null, title: "Making It Always 1:1" }, |
| { id: 2365497, slug: "The-Teacher-The-Best-Interventionist", rating: null, title: "The Teacher: The Best Interventionist." }, |
| { id: 2362077, slug: "Bigger-Brains-than-Youd-Think", rating: null, title: "Bigger Brains than You'd Think" }, |
| { id: 2366395, slug: "from-stress-to-success-1", rating: null, title: "From Stress to Success - Part I" }, |
| { id: 2366494, slug: "from-stress-to-success-2", rating: null, title: "From Stress to Success - Part II" }, |
| { id: 2361972, slug: "socially-savvy", rating: null, title: "Socially Savvy" }, |
| { id: 2365209, slug: "Support-Positive-Friendships", rating: null, title: "Support Positive Friendships" }, |
| { id: 2631052, slug: "the-connection-experience", rating: null, title: "The Connection Experience Part 1" }, |
| { id: 2631052, slug: "the-connection-experience", rating: null, title: "The Connection Experience Part 2" }, |
| { id: 2366433, slug: "The-Very-Very-Child-in-the-Classroom", rating: null, title: "The very-very child in the classroom -" }, |
| { id: 2365566, slug: "when-nothing-works", rating: null, title: "When Nothing Works" }, |
| ], |
| }, |
| le: { |
| instruction: [ |
| { id: 2365565, slug: "Criticism-Praise-Feedback-II", rating: null, title: "Criticism, Praise & Feedback:- part I" }, |
| { id: 2365565, slug: "Criticism-Praise-Feedback-II", rating: null, title: "Criticism, Praise & Feedback:- part II" }, |
| { id: 2365536, slug: "Making-the-Siddur-Come-Alive", rating: null, title: "Making the Siddur Come Alive:" }, |
| { id: 2355276, slug: "the-new-norm-i-love-chumash-2", rating: null, title: "The New Norm: I Love Chumash - Grade 2" }, |
| { id: 2358191, slug: "the-new-norm-i-love-chumash-3-4", rating: null, title: "The New Norm: I Love Chumash - Grade 3-4" }, |
| { id: 2365834, slug: "The-Teacher-as-the-Master-Communicator", rating: null, title: "The Teacher as the Master Communicator" }, |
| { id: 2366818, slug: "Yomim-Noraim-Demystified", rating: null, title: "Yomim Noraim: Demystified" }, |
| { id: 2360205, slug: "all-hands-up", rating: null, title: "All Hands Up" }, |
| { id: 2366931, slug: "Deciphering-the-Dots-in-Kriah", rating: null, title: "Deciphering the Dots in Kriah" }, |
| { id: 2366585, slug: "Every-Student-Every-Lesson-Every-Day", rating: null, title: "Every Student, Every Lesson, Every Day" }, |
| { id: 3430921, slug: "finish-the-year-lower-elem-rebbeim", rating: null, title: "Finishing the Year with a Flourish and Impact - Lower Elementary Rebbeim" }, |
| { id: 3412663, slug: "Pesach-to-Shavuos-sefirah-message", rating: null, title: "From Pesach to Shavuos: The Sefirah Message" }, |
| { id: 3434689, slug: "kabalosh-hatorah-rav-kaplan", rating: null, title: "Kabbalas Hatorah in Ourselves & in Our Talmidim" }, |
| { id: 3360507, slug: "purim-deeper-meaning", rating: null, title: "Purim\u2019s Deeper Meaning for Our Generation" }, |
| { id: 2366817, slug: "Teach-Them-How-to-Think", rating: null, title: "Teach Them How to Think" }, |
| { id: 2360748, slug: "the-underachiever", rating: null, title: "The Underachiever" }, |
| { id: 3412915, slug: "antisemitism-today-2026", rating: null, title: "When History Feels Present" }, |
| { id: 3100995, slug: "aleph-plus-kriah-course", rating: null, title: "Aleph Plus Course Part I" }, |
| { id: 3167010, slug: "connection-within-content", rating: null, title: "Connection within Content" }, |
| { id: 3162708, slug: "executive-function", rating: null, title: "Develop Executive Function Through Direct Instruction" }, |
| { id: 2361890, slug: "in-it-to-win-it", rating: null, title: "In It to Win It: Active Learning Debunked" }, |
| { id: 2362043, slug: "lots-of-loaded-questions", rating: null, title: "Lots of Loaded Questions" }, |
| { id: 3208135, slug: "managing-the-details-in-chumash", rating: null, title: "Managing the Details in Chumash" }, |
| { id: 2367937, slug: "more-retention", rating: null, title: "More Retention" }, |
| { id: 2360800, slug: "simply-chumash", rating: null, title: "Simply Chumash" }, |
| { id: 2368478, slug: "total-participation", rating: null, title: "Total Participation Techniques" }, |
| { id: 2367932, slug: "Tough-Talks-Made-Easy", rating: null, title: "Tough Talks Made Easy" }, |
| ], |
| planning: [ |
| { id: 2360169, slug: "lessons-by-design", rating: null, title: "Lessons by Design" }, |
| { id: 2360823, slug: "all-inclusive-yahadus", rating: null, title: "All Inclusive Yahadus" }, |
| { id: 2368492, slug: "Design-Their-Learning-Journey-For-Dynamite-Results-1", rating: null, title: "Design Their Learning Journey -For Dynamite Results Part I" }, |
| { id: 2369101, slug: "design-their-learning-journey-for-dynamite-results-2", rating: null, title: "Design Their Learning Journey -For Dynamite Results Part II" }, |
| { id: 2369116, slug: "design-their-learning-journey-for-dynamite-results-3", rating: null, title: "Design Their Learning Journey -For Dynamite Results Part III" }, |
| { id: 2360235, slug: "Thinking-is-IN", rating: null, title: "Thinking is IN" }, |
| ], |
| classroom: [ |
| { id: 3340889, slug: "responses-to-misbehavior", rating: null, title: "Responses to Misbehavior" }, |
| { id: 2359306, slug: "The-Classroom-with-No-Ooooohs", rating: null, title: "The Classrooom with No Oooohs!" }, |
| { id: 2367958, slug: "awakening-greatness", rating: null, title: "Awakening Greatness" }, |
| { id: 3311416, slug: "kind-and-firm", rating: null, title: "From Chaos to Calm Intro: Kind and Firm" }, |
| { id: 3324254, slug: "managing-chutzpah", rating: null, title: "From Chaos to Calm: Part 1 Managing chutzpa" }, |
| { id: 3324262, slug: "positive-reinforcement", rating: null, title: "From Chaos to Calm: Part 2 Resetting expectations, positive reinforcement" }, |
| { id: 3340889, slug: "responses-to-misbehavior", rating: null, title: "From Chaos to Calm: Part 3 Responses to Misbehavior" }, |
| { id: 2369215, slug: "management-without-manipulation-1", rating: null, title: "Management without Manipulation Part I" }, |
| { id: 2369216, slug: "management-without-manipulation-2", rating: null, title: "Management without Manipulation Part II" }, |
| { id: 2369698, slug: "management-without-manipulation-3", rating: null, title: "Management without Manipulation Part III" }, |
| { id: 3324291, slug: "principal-role-classroom-management", rating: null, title: "A Principal's Role in Classroom Management" }, |
| { id: 3324262, slug: "positive-reinforcement", rating: null, title: "Resetting Expectations & Positive Enforcement" }, |
| { id: 2539269, slug: "the-flexible-classroom-part-i", rating: null, title: "The Flexible Classroom Part I" }, |
| { id: 2369699, slug: "the-flexible-classroom-2", rating: null, title: "The Flexible Classroom Part II" }, |
| ], |
| wholechild: [ |
| { id: 2363300, slug: "making-the-classroom-a-safe-home", rating: null, title: "Making the Classroom a Safe Home" }, |
| { id: 2365108, slug: "better-behavior-now", rating: null, title: "Better Behavior Now" }, |
| { id: 2363318, slug: "i-like-learning-here", rating: null, title: "I Like Learning Here" }, |
| { id: 2366938, slug: "nervous-no-more", rating: null, title: "Nervous No More" }, |
| { id: 2366565, slug: "the-outlier", rating: null, title: "The Outlier" }, |
| { id: 2359076, slug: "5-ways-to-become-a-motivator", rating: null, title: "5 Ways to Become a Motivator" }, |
| { id: 2368223, slug: "A-Relationship-Prequisite-to-all-Learning", rating: null, title: "A Relationship: Prequisite to all Learning" }, |
| { id: 2360197, slug: "connect-the-dots-of-misbehavior", rating: null, title: "Connect the Dots of Misbehavior" }, |
| { id: 2368491, slug: "culture-the-basis-of-a-classroom", rating: null, title: "Culture: The Basis of a classroom" }, |
| { id: 2366913, slug: "Demystifying-Social-Success", rating: null, title: "Demystifying Social Success" }, |
| { id: 3383324, slug: "helping-child-adhd-succeed", rating: null, title: "Helping the ADHD Child Succeed" }, |
| { id: 2360223, slug: "I-Can-Solve-My-Behavioral-Challenge", rating: null, title: "I Can Solve My Behavioral Challenge" }, |
| { id: 2367969, slug: "Meeting-the-Emotional-Needs-of-our-Children", rating: null, title: "Meeting the Emotional needs of our children" }, |
| { id: 3381118, slug: "anxious-child-in-the-classroom", rating: null, title: "Supporting the Anxious Child in the Classroom" }, |
| { id: 2368092, slug: "boost-attention-and-focus", rating: null, title: "Boost Attention & Focus" }, |
| { id: 2361776, slug: "Clique-Busting", rating: null, title: "Clique Busting" }, |
| { id: 3162708, slug: "executive-function", rating: null, title: "Executive Function" }, |
| { id: 3171072, slug: "frantic-frenzied-and-fretting", rating: null, title: "Frantic, Frenzied, and Fretting" }, |
| { id: 2366395, slug: "from-stress-to-success-1", rating: null, title: "From Stress to Success - Part I" }, |
| { id: 2366494, slug: "from-stress-to-success-2", rating: null, title: "From Stress to Success - Part II" }, |
| { id: 3162755, slug: "inflexible-and-falling-apart", rating: null, title: "Inflexible and Falling Apart" }, |
| { id: 2368464, slug: "Pairing-students-without-Peer-Rejection", rating: null, title: "Pairing students without Peer Rejection" }, |
| { id: 3217156, slug: "resilience-and-grit", rating: null, title: "Resilience and Grit" }, |
| { id: 3149381, slug: "rethinking-bullying", rating: null, title: "Rethinking Bullying" }, |
| { id: 3359760, slug: "rethinking-bullying-part-two", rating: null, title: "Rethinking Bullying: A Resilience-Based Approach for Today\u2019s Classroom Part 2" }, |
| { id: 3167063, slug: "social-smarts", rating: null, title: "Social Smarts" }, |
| { id: 2361972, slug: "socially-savvy", rating: null, title: "Socially Savvy" }, |
| { id: 2365209, slug: "Support-Positive-Friendships", rating: null, title: "Support Positive Friendships" }, |
| { id: 2366433, slug: "The-Very-Very-Child-in-the-Classroom", rating: null, title: "The very-very child in the classroom -" }, |
| { id: 2365566, slug: "when-nothing-works", rating: null, title: "When Nothing Works" }, |
| { id: 3353499, slug: "worry-walks-into-school-part2", rating: null, title: "When Worry Walks into School: Supporting Anxious Students in the Classroom Part 2" }, |
| { id: 3167085, slug: "who's-afraid-of-the-big-bad-bully", rating: null, title: "Who's Afraid of the Big, Bad, Bully?" }, |
| ], |
| }, |
| ue: { |
| instruction: [ |
| { id: 2365565, slug: "Criticism-Praise-Feedback-II", rating: null, title: "Criticism, Praise & Feedback:- part I" }, |
| { id: 2365565, slug: "Criticism-Praise-Feedback-II", rating: null, title: "Criticism, Praise & Feedback:- part II" }, |
| { id: 2365536, slug: "Making-the-Siddur-Come-Alive", rating: null, title: "Making the Siddur Come Alive:" }, |
| { id: 2366875, slug: "Teaching-Rashi-Rethink-React-Renew", rating: null, title: "Teaching Rashi: Rethink,React, Renew." }, |
| { id: 2358769, slug: "the-new-norm-i-love-chumash-5-7", rating: null, title: "The New Norm: I Love Chumash - Grade 5-7" }, |
| { id: 2332180, slug: "the-new-norm-i-love-chumash-8", rating: null, title: "The New Norm: I Love Chumash - Grade 8" }, |
| { id: 2365834, slug: "The-Teacher-as-the-Master-Communicator", rating: null, title: "The Teacher as the Master Communicator" }, |
| { id: 2365101, slug: "they-talk-there-are-solutions", rating: null, title: "They Talk. There are Solutions." }, |
| { id: 2366818, slug: "Yomim-Noraim-Demystified", rating: null, title: "Yomim Noraim: Demystified" }, |
| { id: 2360205, slug: "all-hands-up", rating: null, title: "All Hands Up" }, |
| { id: 2360733, slug: "brains-go-busy", rating: null, title: "Brains go Busy" }, |
| { id: 2366585, slug: "Every-Student-Every-Lesson-Every-Day", rating: null, title: "Every Student, Every Lesson, Every Day" }, |
| { id: 3431328, slug: "finish-the-year-upper-elementary-rebbeim", rating: null, title: "Finishing the Year with a Flourish and Impact - Upper Elementary Rebbeim" }, |
| { id: 3412663, slug: "Pesach-to-Shavuos-sefirah-message", rating: null, title: "From Pesach to Shavuos: The Sefirah Message" }, |
| { id: 3434689, slug: "kabalosh-hatorah-rav-kaplan", rating: null, title: "Kabbalas Hatorah in Ourselves & in Our Talmidim" }, |
| { id: 3434712, slug: "making-torah-hers", rating: null, title: "Making Torah Hers" }, |
| { id: 3360507, slug: "purim-deeper-meaning", rating: null, title: "Purim\u2019s Deeper Meaning for Our Generation" }, |
| { id: 2368433, slug: "smart-start-of-a-lesson", rating: null, title: "Smart Start of a Lesson" }, |
| { id: 2360748, slug: "the-underachiever", rating: null, title: "The Underachiever" }, |
| { id: 3412915, slug: "antisemitism-today-2026", rating: null, title: "When History Feels Present" }, |
| { id: 3167010, slug: "connection-within-content", rating: null, title: "Connection within Content" }, |
| { id: 2365546, slug: "creating-independent-learners", rating: null, title: "Creating Independent Learners" }, |
| { id: 3162708, slug: "executive-function", rating: null, title: "Develop Executive Function Through Direct Instruction" }, |
| { id: 2359151, slug: "emunah-in-their-language", rating: null, title: "Emunah in their Language" }, |
| { id: 2365809, slug: "from-huh-to-aha", rating: null, title: "From Huh? to Aha!" }, |
| { id: 2361890, slug: "in-it-to-win-it", rating: null, title: "In It to Win It: Active Learning Debunked" }, |
| { id: 2362043, slug: "lots-of-loaded-questions", rating: null, title: "Lots of Loaded Questions" }, |
| { id: 3208135, slug: "managing-the-details-in-chumash", rating: null, title: "Managing the Details in Chumash" }, |
| { id: 2367937, slug: "more-retention", rating: null, title: "More Retention" }, |
| { id: 2366529, slug: "Navi-vs-Chumash-A-Study-in-Contrasts", rating: null, title: "Navi vs. Chumash: A Study in Contrasts" }, |
| { id: 2366940, slug: "Teaching-Rashi-as-a-Third-Language", rating: null, title: "Teaching Rashi as a Third Language" }, |
| { id: 2362059, slug: "that-works", rating: null, title: "That Works!" }, |
| { id: 2368478, slug: "total-participation", rating: null, title: "Total Participation Techniques" }, |
| { id: 2367932, slug: "Tough-Talks-Made-Easy", rating: null, title: "Tough Talks Made Easy" }, |
| { id: 2362006, slug: "wait-I-cant-write-so-fast", rating: null, title: "Wait! I can't write so fast" }, |
| ], |
| planning: [ |
| { id: 2360169, slug: "lessons-by-design", rating: null, title: "Lessons by Design" }, |
| { id: 2363219, slug: "Halacha-Accurate-Relevant-Engaging", rating: null, title: "Halacha: Accurate, Relevant, Engaging" }, |
| { id: 2360264, slug: "navi-and-me", rating: null, title: "Navi and Me" }, |
| { id: 3365405, slug: "seven-haggadah-tips", rating: null, title: "Seven Effective Teaching Haggadah Tips" }, |
| { id: 3353453, slug: "a-purim-conversation", rating: null, title: "What Do We Want Them to Remember? A Purim Conversation" }, |
| { id: 2361827, slug: "a-for-teachers", rating: null, title: "A+ for Teachers" }, |
| { id: 2360823, slug: "all-inclusive-yahadus", rating: null, title: "All Inclusive Yahadus" }, |
| { id: 2368492, slug: "Design-Their-Learning-Journey-For-Dynamite-Results-1", rating: null, title: "Design Their Learning Journey -For Dynamite Results Part I" }, |
| { id: 2369101, slug: "design-their-learning-journey-for-dynamite-results-2", rating: null, title: "Design Their Learning Journey -For Dynamite Results Part II" }, |
| { id: 2369116, slug: "design-their-learning-journey-for-dynamite-results-3", rating: null, title: "Design Their Learning Journey -For Dynamite Results Part III" }, |
| { id: 2360235, slug: "Thinking-is-IN", rating: null, title: "Thinking is IN" }, |
| ], |
| classroom: [ |
| { id: 3340889, slug: "responses-to-misbehavior", rating: null, title: "Responses to Misbehavior" }, |
| { id: 3204302, slug: "tackle-the-talking", rating: null, title: "Tackle the Talking" }, |
| { id: 2359306, slug: "The-Classroom-with-No-Ooooohs", rating: null, title: "The Classrooom with No Oooohs!" }, |
| { id: 2367958, slug: "awakening-greatness", rating: null, title: "Awakening Greatness" }, |
| { id: 3311416, slug: "kind-and-firm", rating: null, title: "From Chaos to Calm Intro: Kind and Firm" }, |
| { id: 3324254, slug: "managing-chutzpah", rating: null, title: "From Chaos to Calm: Part 1 Managing chutzpa" }, |
| { id: 3324262, slug: "positive-reinforcement", rating: null, title: "From Chaos to Calm: Part 2 Resetting expectations, positive reinforcement" }, |
| { id: 3340889, slug: "responses-to-misbehavior", rating: null, title: "From Chaos to Calm: Part 3 Responses to Misbehavior" }, |
| { id: 2369215, slug: "management-without-manipulation-1", rating: null, title: "Management without Manipulation Part I" }, |
| { id: 2369216, slug: "management-without-manipulation-2", rating: null, title: "Management without Manipulation Part II" }, |
| { id: 2369698, slug: "management-without-manipulation-3", rating: null, title: "Management without Manipulation Part III" }, |
| { id: 3324291, slug: "principal-role-classroom-management", rating: null, title: "A Principal's Role in Classroom Management" }, |
| { id: 3324262, slug: "positive-reinforcement", rating: null, title: "Resetting Expectations & Positive Enforcement" }, |
| { id: 2539269, slug: "the-flexible-classroom-part-i", rating: null, title: "The Flexible Classroom Part I" }, |
| { id: 2369699, slug: "the-flexible-classroom-2", rating: null, title: "The Flexible Classroom Part II" }, |
| ], |
| wholechild: [ |
| { id: 2365108, slug: "better-behavior-now", rating: null, title: "Better Behavior Now" }, |
| { id: 2363318, slug: "i-like-learning-here", rating: null, title: "I Like Learning Here" }, |
| { id: 2366938, slug: "nervous-no-more", rating: null, title: "Nervous No More" }, |
| { id: 2366565, slug: "the-outlier", rating: null, title: "The Outlier" }, |
| { id: 2359076, slug: "5-ways-to-become-a-motivator", rating: null, title: "5 Ways to Become a Motivator" }, |
| { id: 3360127, slug: "understanding-our-talmidim", rating: null, title: "A Deep Dive into Understanding Our Talmidim: Gain Insight into the Whole Child" }, |
| { id: 2368223, slug: "A-Relationship-Prequisite-to-all-Learning", rating: null, title: "A Relationship: Prequisite to all Learning" }, |
| { id: 2360197, slug: "connect-the-dots-of-misbehavior", rating: null, title: "Connect the Dots of Misbehavior" }, |
| { id: 2368491, slug: "culture-the-basis-of-a-classroom", rating: null, title: "Culture: The Basis of a classroom" }, |
| { id: 3383324, slug: "helping-child-adhd-succeed", rating: null, title: "Helping the ADHD Child Succeed" }, |
| { id: 2360223, slug: "I-Can-Solve-My-Behavioral-Challenge", rating: null, title: "I Can Solve My Behavioral Challenge" }, |
| { id: 2367969, slug: "Meeting-the-Emotional-Needs-of-our-Children", rating: null, title: "Meeting the Emotional needs of our children" }, |
| { id: 3381118, slug: "anxious-child-in-the-classroom", rating: null, title: "Supporting the Anxious Child in the Classroom" }, |
| { id: 2368092, slug: "boost-attention-and-focus", rating: null, title: "Boost Attention & Focus" }, |
| { id: 2361776, slug: "Clique-Busting", rating: null, title: "Clique Busting" }, |
| { id: 3171072, slug: "frantic-frenzied-and-fretting", rating: null, title: "Frantic, Frenzied, and Fretting" }, |
| { id: 2366395, slug: "from-stress-to-success-1", rating: null, title: "From Stress to Success - Part I" }, |
| { id: 2366494, slug: "from-stress-to-success-2", rating: null, title: "From Stress to Success - Part II" }, |
| { id: 2368464, slug: "Pairing-students-without-Peer-Rejection", rating: null, title: "Pairing students without Peer Rejection" }, |
| { id: 3217156, slug: "resilience-and-grit", rating: null, title: "Resilience and Grit" }, |
| { id: 3149381, slug: "rethinking-bullying", rating: null, title: "Rethinking Bullying" }, |
| { id: 3359760, slug: "rethinking-bullying-part-two", rating: null, title: "Rethinking Bullying: A Resilience-Based Approach for Today\u2019s Classroom Part 2" }, |
| { id: 2361972, slug: "socially-savvy", rating: null, title: "Socially Savvy" }, |
| { id: 2365209, slug: "Support-Positive-Friendships", rating: null, title: "Support Positive Friendships" }, |
| { id: 2366433, slug: "The-Very-Very-Child-in-the-Classroom", rating: null, title: "The very-very child in the classroom -" }, |
| { id: 2365566, slug: "when-nothing-works", rating: null, title: "When Nothing Works" }, |
| { id: 3353499, slug: "worry-walks-into-school-part2", rating: null, title: "When Worry Walks into School: Supporting Anxious Students in the Classroom Part 2" }, |
| { id: 3167085, slug: "who's-afraid-of-the-big-bad-bully", rating: null, title: "Who's Afraid of the Big, Bad, Bully?" }, |
| ], |
| }, |
| hs: { |
| instruction: [ |
| { id: 2365565, slug: "Criticism-Praise-Feedback-II", rating: null, title: "Criticism, Praise & Feedback:- part I" }, |
| { id: 2365565, slug: "Criticism-Praise-Feedback-II", rating: null, title: "Criticism, Praise & Feedback:- part II" }, |
| { id: 2365834, slug: "The-Teacher-as-the-Master-Communicator", rating: null, title: "The Teacher as the Master Communicator" }, |
| { id: 2365101, slug: "they-talk-there-are-solutions", rating: null, title: "They Talk. There are Solutions." }, |
| { id: 2366818, slug: "Yomim-Noraim-Demystified", rating: null, title: "Yomim Noraim: Demystified" }, |
| { id: 2360205, slug: "all-hands-up", rating: null, title: "All Hands Up" }, |
| { id: 2360733, slug: "brains-go-busy", rating: null, title: "Brains go Busy" }, |
| { id: 2366585, slug: "Every-Student-Every-Lesson-Every-Day", rating: null, title: "Every Student, Every Lesson, Every Day" }, |
| { id: 3412663, slug: "Pesach-to-Shavuos-sefirah-message", rating: null, title: "From Pesach to Shavuos: The Sefirah Message" }, |
| { id: 3434689, slug: "kabalosh-hatorah-rav-kaplan", rating: null, title: "Kabbalas Hatorah in Ourselves & in Our Talmidim" }, |
| { id: 3434712, slug: "making-torah-hers", rating: null, title: "Making Torah Hers" }, |
| { id: 3360507, slug: "purim-deeper-meaning", rating: null, title: "Purim\u2019s Deeper Meaning for Our Generation" }, |
| { id: 2368433, slug: "smart-start-of-a-lesson", rating: null, title: "Smart Start of a Lesson" }, |
| { id: 2366436, slug: "The-Meforshim-are-Talking-to-Me", rating: null, title: "The Meforshim are Talking to Me" }, |
| { id: 2360748, slug: "the-underachiever", rating: null, title: "The Underachiever" }, |
| { id: 3412915, slug: "antisemitism-today-2026", rating: null, title: "When History Feels Present" }, |
| { id: 2365546, slug: "creating-independent-learners", rating: null, title: "Creating Independent Learners" }, |
| { id: 3162708, slug: "executive-function", rating: null, title: "Develop Executive Function Through Direct Instruction" }, |
| { id: 2359151, slug: "emunah-in-their-language", rating: null, title: "Emunah in their Language" }, |
| { id: 2365809, slug: "from-huh-to-aha", rating: null, title: "From Huh? to Aha!" }, |
| { id: 2361890, slug: "in-it-to-win-it", rating: null, title: "In It to Win It: Active Learning Debunked" }, |
| { id: 2362043, slug: "lots-of-loaded-questions", rating: null, title: "Lots of Loaded Questions" }, |
| { id: 2367937, slug: "more-retention", rating: null, title: "More Retention" }, |
| { id: 2366529, slug: "Navi-vs-Chumash-A-Study-in-Contrasts", rating: null, title: "Navi vs. Chumash: A Study in Contrasts" }, |
| { id: 2369118, slug: "Putting-Text-and-Thinking-Together-1", rating: null, title: "Putting Text and Thinking Together Part I" }, |
| { id: 2369140, slug: "putting-text-and-thinking-together-2", rating: null, title: "Putting Text and Thinking Together Part II" }, |
| { id: 2369139, slug: "putting-text-and-thinking-together-3", rating: null, title: "Putting Text and Thinking Together Part III" }, |
| { id: 2362059, slug: "that-works", rating: null, title: "That Works!" }, |
| { id: 2366939, slug: "The-Gifted-The-Average-The-Struggling", rating: null, title: "The Gifted, The Average, The Struggling" }, |
| { id: 2367932, slug: "Tough-Talks-Made-Easy", rating: null, title: "Tough Talks Made Easy" }, |
| ], |
| planning: [ |
| { id: 2360169, slug: "lessons-by-design", rating: null, title: "Lessons by Design" }, |
| { id: 2363219, slug: "Halacha-Accurate-Relevant-Engaging", rating: null, title: "Halacha: Accurate, Relevant, Engaging" }, |
| { id: 2360264, slug: "navi-and-me", rating: null, title: "Navi and Me" }, |
| { id: 2360941, slug: "neviim-acharonim-the-broad-picture-and-me", rating: null, title: "Neviim Ahcharonim: The Broad Picture and Me" }, |
| { id: 3353453, slug: "a-purim-conversation", rating: null, title: "What Do We Want Them to Remember? A Purim Conversation" }, |
| { id: 2361827, slug: "a-for-teachers", rating: null, title: "A+ for Teachers" }, |
| { id: 2360823, slug: "all-inclusive-yahadus", rating: null, title: "All Inclusive Yahadus" }, |
| { id: 2365557, slug: "navigating-the-meforshim", rating: null, title: "Navigating the Meforshim" }, |
| { id: 2360235, slug: "Thinking-is-IN", rating: null, title: "Thinking is IN" }, |
| ], |
| classroom: [ |
| { id: 3340889, slug: "responses-to-misbehavior", rating: null, title: "Responses to Misbehavior" }, |
| { id: 3204302, slug: "tackle-the-talking", rating: null, title: "Tackle the Talking" }, |
| { id: 3311416, slug: "kind-and-firm", rating: null, title: "From Chaos to Calm Intro: Kind and Firm" }, |
| { id: 3324254, slug: "managing-chutzpah", rating: null, title: "From Chaos to Calm: Part 1 Managing chutzpa" }, |
| { id: 3324262, slug: "positive-reinforcement", rating: null, title: "From Chaos to Calm: Part 2 Resetting expectations, positive reinforcement" }, |
| { id: 3340889, slug: "responses-to-misbehavior", rating: null, title: "From Chaos to Calm: Part 3 Responses to Misbehavior" }, |
| { id: 3324291, slug: "principal-role-classroom-management", rating: null, title: "A Principal's Role in Classroom Management" }, |
| { id: 3324262, slug: "positive-reinforcement", rating: null, title: "Resetting Expectations & Positive Enforcement" }, |
| ], |
| wholechild: [ |
| { id: 2363318, slug: "i-like-learning-here", rating: null, title: "I Like Learning Here" }, |
| { id: 2366938, slug: "nervous-no-more", rating: null, title: "Nervous No More" }, |
| { id: 2366565, slug: "the-outlier", rating: null, title: "The Outlier" }, |
| { id: 2359076, slug: "5-ways-to-become-a-motivator", rating: null, title: "5 Ways to Become a Motivator" }, |
| { id: 3360127, slug: "understanding-our-talmidim", rating: null, title: "A Deep Dive into Understanding Our Talmidim: Gain Insight into the Whole Child" }, |
| { id: 2360197, slug: "connect-the-dots-of-misbehavior", rating: null, title: "Connect the Dots of Misbehavior" }, |
| { id: 3383324, slug: "helping-child-adhd-succeed", rating: null, title: "Helping the ADHD Child Succeed" }, |
| { id: 2360223, slug: "I-Can-Solve-My-Behavioral-Challenge", rating: null, title: "I Can Solve My Behavioral Challenge" }, |
| { id: 2367969, slug: "Meeting-the-Emotional-Needs-of-our-Children", rating: null, title: "Meeting the Emotional needs of our children" }, |
| { id: 3381118, slug: "anxious-child-in-the-classroom", rating: null, title: "Supporting the Anxious Child in the Classroom" }, |
| { id: 3217037, slug: "key-learning-points", rating: null, title: "A Nurturing Classroom Environment - Part 1" }, |
| { id: 3216911, slug: "inside-the-classroom", rating: null, title: "A Nurturing Classroom Environment - Part 2" }, |
| { id: 3210073, slug: "teachers-masters-of-connection", rating: null, title: "A Nurturing Classroom Environment - Part 3" }, |
| { id: 3209172, slug: "emotional-wellbeing-in-the-classroom", rating: null, title: "Emotional Wellbeing in the Classroom" }, |
| { id: 2366395, slug: "from-stress-to-success-1", rating: null, title: "From Stress to Success - Part I" }, |
| { id: 2366494, slug: "from-stress-to-success-2", rating: null, title: "From Stress to Success - Part II" }, |
| { id: 2368464, slug: "Pairing-students-without-Peer-Rejection", rating: null, title: "Pairing students without Peer Rejection" }, |
| { id: 3171311, slug: "regulate-to-relate", rating: null, title: "Regulate to Relate" }, |
| { id: 3173700, slug: "repairing-low-self-esteem", rating: null, title: "Repairing Low Self-Esteem" }, |
| { id: 3353499, slug: "worry-walks-into-school-part2", rating: null, title: "When Worry Walks into School: Supporting Anxious Students in the Classroom Part 2" }, |
| ], |
| }, |
| }; |
| /* ===================================================================== |
| CONFIG D — SETTINGS |
| ===================================================================== */ |
| var SHUFFLE = true; // interleave questions so domains aren't clustered |
| var PLAN_SIZE = 6; // total courses recommended (informational) |
| var BACKEND_URL = ""; // TODO: your serverless endpoint, e.g. https://your-app.vercel.app/api/enroll |
| /* ============================ ENGINE ================================ */ |
| // Profile shapes — first match wins. Returns { shape, alloc:{domainKey:count} }. |
| // Four domains; every shape totals 6 courses. |
| function pickShape(scores) { |
| var ranked = Object.keys(scores) |
| .map(function (k) { return [k, scores[k]]; }) |
| .sort(function (a, b) { return a[1] - b[1]; }); // ascending (weakest first) |
| var alloc = {}; |
| Object.keys(scores).forEach(function (k) { alloc[k] = 0; }); |
| var lowK = ranked[0][0], lowV = ranked[0][1]; |
| var low2K = ranked[1][0], low2V = ranked[1][1]; |
| var topV = ranked[ranked.length - 1][1]; |
| var nextTopV = ranked[ranked.length - 2][1]; |
| // Deep Dive: one deep, isolated growth area (4 + 1 + 1) |
| if (lowV <= 2.5 && (low2V - lowV) >= 1.0) { |
| alloc[lowK] = 4; alloc[ranked[1][0]] = 1; alloc[ranked[2][0]] = 1; |
| return { shape: "Deep Dive", alloc: alloc }; |
| } |
| // Twin Focus: two soft spots close together (2 + 2 + 1 + 1) |
| if (lowV <= 3.0 && low2V <= 3.0 && (low2V - lowV) <= 0.5) { |
| alloc[lowK] = 2; alloc[low2K] = 2; alloc[ranked[2][0]] = 1; alloc[ranked[3][0]] = 1; |
| return { shape: "Twin Focus", alloc: alloc }; |
| } |
| // Targeted: one clear soft spot (3 + 1 + 1 + 1) |
| if (lowV <= 3.0) { |
| alloc[lowK] = 3; alloc[ranked[1][0]] = 1; alloc[ranked[2][0]] = 1; alloc[ranked[3][0]] = 1; |
| return { shape: "Targeted", alloc: alloc }; |
| } |
| // Strength-Led: strong overall, one standout strength — skip it (2 + 2 + 2) |
| if (lowV >= 3.5 && (topV - nextTopV) >= 0.7) { |
| alloc[ranked[0][0]] = 2; alloc[ranked[1][0]] = 2; alloc[ranked[2][0]] = 2; |
| return { shape: "Strength-Led", alloc: alloc }; |
| } |
| // Balanced (default): a bit more weight on the two lower areas (2 + 2 + 1 + 1) |
| alloc[ranked[0][0]] = 2; alloc[ranked[1][0]] = 2; alloc[ranked[2][0]] = 1; alloc[ranked[3][0]] = 1; |
| return { shape: "Balanced", alloc: alloc }; |
| } |
| // Difficulty banding + rating tiebreak. |
| // The catalog is ordered most basic -> most advanced, and within the same |
| // difficulty level, by rating (1 first, then 2, then 3). The teacher's domain |
| // score slides the window: a low score starts at the basic end, a high score |
| // at the advanced end. So a stronger teacher gets more advanced classes, and |
| // when several classes sit at the same level, the higher-rated ones win. |
| // Completed courses are skipped. |
| function pickCourses(domainKey, count, score, grade, completedSet) { |
| if (count <= 0) return []; |
| var list = (COURSE_CATALOG[grade] && COURSE_CATALOG[grade][domainKey]) || []; |
| var available = list.filter(function (c) { return !completedSet.has(String(c.id)); }); |
| if (available.length <= count) return available.slice(0, count); |
| var frac = Math.max(0, Math.min(1, (score - 1) / 4)); // 0 weak .. 1 strong |
| var maxStart = available.length - count; |
| var start = Math.max(0, Math.min(maxStart, Math.round(frac * maxStart))); |
| return available.slice(start, start + count); |
| } |
| function buildPlan(scores, grade, completedSet) { |
| var result = pickShape(scores); |
| var plan = []; |
| Object.keys(result.alloc).forEach(function (domainKey) { |
| var n = result.alloc[domainKey]; |
| pickCourses(domainKey, n, scores[domainKey], grade, completedSet).forEach(function (course) { |
| plan.push({ domain: domainKey, course: course }); |
| }); |
| }); |
| return { shape: result.shape, alloc: result.alloc, plan: plan }; |
| } |
| /* ============================ UI ==================================== */ |
| function shuffle(arr) { |
| var a = arr.slice(); |
| for (var i = a.length - 1; i > 0; i--) { |
| var j = Math.floor(Math.random() * (i + 1)); |
| var t = a[i]; a[i] = a[j]; a[j] = t; |
| } |
| return a; |
| } |
| var root = document.getElementById("pd-quiz"); |
| var order = SHUFFLE ? shuffle(QUESTIONS) : QUESTIONS; |
| var responses = {}; // questionIndex -> 1..5 |
| function render() { |
| var gradeOpts = GRADE_LEVELS.map(function (g) { |
| return '<option value="' + g.key + '">' + g.label + "</option>"; |
| }).join(""); |
| var html = |
| "<h2>Your professional growth check-in</h2>" + |
| '<p class="sub">' + QUESTIONS.length + " quick questions. Rate each 1 (not yet) to 5 (consistently true). " + |
| "You\u2019ll get a personalized plan of " + PLAN_SIZE + " courses.</p>" + |
| '<div class="field"><label><strong>What grade level do you teach?</strong></label><br>' + |
| '<select id="pd-grade"><option value="">Choose\u2026</option>' + gradeOpts + "</select></div>"; |
| order.forEach(function (q, i) { |
| var scale = ""; |
| for (var v = 1; v <= 5; v++) { |
| scale += |
| '<label><input type="radio" name="q' + i + '" value="' + v + '">' + |
| "<span>" + v + "</span></label>"; |
| } |
| html += '<div class="q"><p>' + (i + 1) + ". " + q.text + '</p><div class="scale">' + scale + "</div></div>"; |
| }); |
| html += '<div id="pd-hint" class="sub" style="margin-top:20px"></div>' + |
| '<button id="pd-submit">Build my plan</button><div id="pd-result"></div>'; |
| root.innerHTML = html; |
| function updateHint() { |
| var grade = document.getElementById("pd-grade").value; |
| var n = Object.keys(responses).length; |
| var hint = document.getElementById("pd-hint"); |
| if (grade && n === QUESTIONS.length) { hint.textContent = "All set \u2014 build your plan."; } |
| else { |
| var bits = []; |
| if (!grade) bits.push("choose a grade level"); |
| if (n < QUESTIONS.length) bits.push("answer all " + QUESTIONS.length + " questions (" + n + " done)"); |
| hint.textContent = "To continue: " + bits.join(" and ") + "."; |
| } |
| } |
| root.addEventListener("change", function (e) { |
| if (e.target.name && e.target.name.indexOf("q") === 0) { |
| responses[parseInt(e.target.name.slice(1), 10)] = parseInt(e.target.value, 10); |
| } |
| updateHint(); |
| }); |
| updateHint(); |
| document.getElementById("pd-submit").addEventListener("click", submit); |
| } |
| function submit() { |
| var grade = document.getElementById("pd-grade").value; |
| var answered = Object.keys(responses).length; |
| if (!grade || answered < QUESTIONS.length) { |
| document.getElementById("pd-result").innerHTML = |
| '<p class="err" style="margin-top:16px">Please choose a grade and answer all ' + |
| QUESTIONS.length + ' questions first \u2014 you\u2019ve answered ' + answered + '.</p>'; |
| document.getElementById("pd-result").scrollIntoView({ behavior: "smooth" }); |
| return; |
| } |
| // Score each domain (average of its two questions) |
| var sums = {}, counts = {}; |
| Object.keys(DOMAINS).forEach(function (k) { sums[k] = 0; counts[k] = 0; }); |
| order.forEach(function (q, i) { |
| sums[q.domain] += responses[i]; |
| counts[q.domain] += 1; |
| }); |
| var scores = {}; |
| Object.keys(DOMAINS).forEach(function (k) { scores[k] = sums[k] / counts[k]; }); |
| var completedSet = new Set((window.COMPLETED_COURSE_IDS || []).map(String)); |
| var built = buildPlan(scores, grade, completedSet); |
| renderResult(built, scores); |
| enroll(built); |
| } |
| function renderResult(built, scores) { |
| var out = document.getElementById("pd-result"); |
| var byDomain = {}; |
| built.plan.forEach(function (item) { |
| (byDomain[item.domain] = byDomain[item.domain] || []).push(item.course); |
| }); |
| var html = '<h2 style="margin-top:32px">Your plan: ' + built.shape + "</h2>"; |
| if (built.plan.length === 0) { |
| html += '<p class="err">No courses are configured yet for this grade level. ' + |
| "Fill in COURSE_CATALOG, then republish.</p>"; |
| } |
| Object.keys(DOMAINS).forEach(function (k) { |
| if (!byDomain[k]) return; |
| html += '<div class="plan-domain">' + DOMAINS[k] + "</div>"; |
| byDomain[k].forEach(function (c) { |
| var title = c.title || ("Course " + c.id); |
| var link = c.slug ? ' \u2014 <a href="/courses/take/' + c.slug + '">open</a>' : ""; |
| html += '<div class="plan-course">' + title + link + "</div>"; |
| }); |
| }); |
| out.innerHTML = html; |
| out.scrollIntoView({ behavior: "smooth" }); |
| } |
| function enroll(built) { |
| if (!BACKEND_URL || window.THINKIFIC_USER.id === "PREVIEW") return; // skip in preview / until wired |
| // Send the full plan (id + slug + title) so the backend can enroll AND |
| // save it for the "My PD Plan" page. |
| var plan = built.plan.map(function (item) { |
| return { |
| id: item.course.id, |
| slug: item.course.slug || "", |
| title: item.course.title || ("Course " + item.course.id), |
| domain: item.domain |
| }; |
| }); |
| fetch(BACKEND_URL, { |
| method: "POST", |
| // text/plain keeps this a "simple" request, avoiding the CORS preflight |
| // that Google Apps Script web apps can't respond to. Body is still JSON. |
| headers: { "Content-Type": "text/plain;charset=utf-8" }, |
| body: JSON.stringify({ |
| userId: window.THINKIFIC_USER.id, |
| email: window.THINKIFIC_USER.email, |
| plan: plan, |
| shape: built.shape |
| }) |
| }).catch(function (err) { console.error("Enrollment request failed:", err); }); |
| } |
| render(); |
| })(); |
| </script> |