1const SUPABASE_CONFIG = { 2 url: "https://dyvvhmuegtzooijrtwyd.supabase.co", 3 anonKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImR5dnZobXVlZ3R6b29panJ0d3lkIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzkwOTk5MTEsImV4cCI6MjA5NDY3NTkxMX0.pksVza66eu3WlM1_r_IGARkjd19BwUvbKntoUIwPhRY", 4}; 5 6async function saveToSupabase(result) { 7 // â Koi bhi guard check NAHI â seedha save karo 8 const weakTopics = 9 (result.topicAnalysis || []) 10 .filter((t) => t.attempted > 0) 11 .sort((a, b) => a.acc - b.acc) 12 .slice(0, 3) 13 .map((t) => `${t.name} (${t.acc}%)`) 14 .join(", ") || null; 15 16 const topicScores = {}; 17 (result.topicAnalysis || []).forEach((t) => { 18 topicScores[t.name] = { 19 total: t.total, 20 correct: t.correct, 21 wrong: t.wrong, 22 accuracy: t.acc, 23 }; 24 }); 25 26 const row = { 27 student_name: result.student.name, 28 student_email: result.student.email, 29 student_phone: result.student.phone, 30 sat_score: result.scaled || null, 31 rw_score: result.rwScore || null, 32 math_score: result.mathScore || null, 33 percentage: result.pct, 34 grade: result.grade, 35 correct: result.correct, 36 wrong: result.wrong, 37 skipped: result.unattempted, 38 total: result.total, 39 topic_scores: topicScores, 40 weak_topics: weakTopics, 41 submitted_at: result.submitTime, 42 created_at: new Date().toISOString(), 43 }; 44 45 console.log("ð¤ Supabase ko data bhej raha hoon...", row); 46 47 try { 48 const res = await fetch(`${SUPABASE_CONFIG.url}/rest/v1/sat_results`, { 49 method: "POST", 50 headers: { 51 "Content-Type": "application/json", 52 apikey: SUPABASE_CONFIG.anonKey, 53 Authorization: `Bearer ${SUPABASE_CONFIG.anonKey}`, 54 Prefer: "return=minimal", 55 }, 56 body: JSON.stringify(row), 57 }); 58 59 if (res.ok || res.status === 201) { 60 console.log("â Supabase mein save ho gaya!"); 61 } else { 62 const errText = await res.text(); 63 console.error("â Supabase error:", res.status, errText); 64 } 65 } catch (err) { 66 console.error("â Network error:", err); 67 } 68}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.