brain backup 2026-09-14
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,20 @@
|
||||
export function isGradeThreeSource(source) {
|
||||
return /\bGrade 3\b/i.test(source.title ?? '') || /(?:^|[_-])G3(?:[_-]|$)/i.test(source.filename ?? '');
|
||||
}
|
||||
|
||||
export function classifyUnit(filename) {
|
||||
const name = String(filename);
|
||||
if (/CKMath/i.test(name)) return 'Math';
|
||||
if (/CKSci/i.test(name)) return 'Science';
|
||||
if (/CKLA/i.test(name)) return 'Language Arts';
|
||||
if (/CKHG|CKIYS|LABB_CKHG/i.test(name)) return 'History & Geography';
|
||||
if (/CKMusic|CKVA/i.test(name)) return 'Arts';
|
||||
return 'Other';
|
||||
}
|
||||
|
||||
export function roleForPdf(filename) {
|
||||
const name = String(filename);
|
||||
if (/(?:^|[_-])(TG|TeacherGuide|Teacher[_ -]?Guide)(?:[_-]|\.)/i.test(name)) return 'Teacher Guide';
|
||||
if (/(?:^|[_-])(SR|StudentReader|Student[_ -]?Reader|ActivityBook)(?:[_-]|\.)/i.test(name)) return 'Student Reader';
|
||||
return 'Reference';
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
export function subjectsFor(units) {
|
||||
return ['All', ...new Set(units.map((unit) => unit.subject).filter(Boolean))].sort((a, b) => {
|
||||
if (a === 'All') return -1;
|
||||
if (b === 'All') return 1;
|
||||
return a.localeCompare(b);
|
||||
});
|
||||
}
|
||||
|
||||
export function filterUnits(units, subject) {
|
||||
return subject === 'All' ? units : units.filter((unit) => unit.subject === subject);
|
||||
}
|
||||
|
||||
export function teacherGuidesFor(unit) {
|
||||
return (unit.materials ?? []).filter((material) => material.role === 'Teacher Guide');
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
def material_index(catalog):
|
||||
"""Map only generated catalog IDs to their exact archive member paths."""
|
||||
index = {}
|
||||
for unit in catalog.get('units', []):
|
||||
archive_name = unit.get('filename')
|
||||
if not archive_name:
|
||||
continue
|
||||
for material in unit.get('materials', []):
|
||||
material_id = material.get('id')
|
||||
internal_path = material.get('internal_path')
|
||||
if material_id and internal_path:
|
||||
index[material_id] = (archive_name, internal_path)
|
||||
return index
|
||||
|
||||
|
||||
def lookup_material(index, material_id):
|
||||
"""Return a declared pair or None; request input is never a filesystem path."""
|
||||
return index.get(material_id)
|
||||
@@ -0,0 +1,16 @@
|
||||
export function isCorrectTotal(value) {
|
||||
return Number(String(value).trim()) === 14;
|
||||
}
|
||||
|
||||
export function isCorrectEquation(value) {
|
||||
const numbers = String(value).match(/\d+/g)?.map(Number) ?? [];
|
||||
if (numbers.length !== 3) return false;
|
||||
const [first, second, product] = numbers;
|
||||
return product === 14 && ((first === 7 && second === 2) || (first === 2 && second === 7));
|
||||
}
|
||||
|
||||
export function hasReasoningEvidence(value) {
|
||||
const text = String(value).toLowerCase();
|
||||
const strategy = /group|each|repeated|add|plus/.test(text);
|
||||
return strategy && /\b14\b/.test(text);
|
||||
}
|
||||
Reference in New Issue
Block a user