Online Homework Grader

AI-Powered Homework Grader

Automate grading by providing an answer key and the student's submission.

Enter each question or topic on a new line, followed by a colon and the expected keyword(s). E.g., Capital of France: Paris

3. Graded Report

The graded report will appear here after you grade the submission.

${item.comment}

`; }); let overallComment = 'Good effort. Review the incorrect items for improvement.'; if (reportData.score >= 90) overallComment = 'Excellent work! A thorough and accurate submission.'; else if (reportData.score >= 70) overallComment = 'Solid submission with a good understanding of the material.'; else if (reportData.score < 50) overallComment = 'Significant review needed. Please see me for extra help.'; reportContainer.innerHTML = `

Grading Report

Final Score

${reportData.score.toFixed(0)}%

Detailed Feedback

${feedbackHTML}

Overall Comments

${overallComment}

`; }; // --- EVENT LISTENERS --- gradeBtn.addEventListener('click', gradeSubmission); // --- PDF DOWNLOAD --- downloadPdfBtn.addEventListener('click', () => { const reportElement = document.getElementById('pdf-content'); if (!reportElement) { alert("Please grade a submission first."); return; } html2canvas(reportElement, { scale: 2, // Higher resolution backgroundColor: '#f8fafc' }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const { jsPDF } = window.jspdf; const doc = new jsPDF('p', 'mm', 'a4'); const pageWidth = doc.internal.pageSize.getWidth(); const pageHeight = doc.internal.pageSize.getHeight(); const margin = 15; // Header doc.setFontSize(24); doc.setFont('helvetica', 'bold'); doc.text('Homework Grading Report', pageWidth / 2, margin + 10, { align: 'center' }); doc.setFontSize(11); doc.text(`Graded on: ${new Date().toLocaleDateString()}`, pageWidth / 2, margin + 18, { align: 'center' }); // Add the captured report as an image const imgProps = doc.getImageProperties(imgData); const pdfWidth = pageWidth - (margin * 2); const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width; doc.addImage(imgData, 'PNG', margin, margin + 30, pdfWidth, pdfHeight); // Footer doc.setFontSize(9); doc.setTextColor(150); doc.text('Page 1 of 1', pageWidth - margin, pageHeight - 10, { align: 'right' }); doc.save('homework-grade-report.pdf'); }); }); // --- INITIALIZATION --- loadSampleData(); });
Scroll to Top