Task-Based Efficiency Assessment Tool

Task-Based Efficiency Assessment

Assess Individual Task Efficiency

Reflection

Assessment Summary

  • No tasks assessed yet in this session.

No overall summary yet.

'; if(pdfSummaryButton) pdfSummaryButton.disabled = true; return; } let totalEstimated = 0, totalActual = 0, totalRatioSum = 0; let unitConsistent = true; const firstUnit = tbeatAssessedTasks.length > 0 ? tbeatAssessedTasks[0].unit : "units"; tbeatAssessedTasks.forEach(task => { const item = document.createElement('li'); item.className = 'tbeat-summary-item'; item.innerHTML = `

${task.name}

Est. vs Actual: ${task.estimated.toFixed(1)} ${task.unit} vs ${task.actual.toFixed(1)} ${task.unit}

Variance: ${task.variance.toFixed(1)} ${task.unit} (${task.variance > 0 ? 'Overran' : (task.variance < 0 ? 'Faster' : 'On Target')})

Efficiency: ${task.efficiencyRatio.toFixed(1)}% (${task.interpretation})

${task.complexity !== 'N/A' ? `

Complexity: ${task.complexity}

` : ''} ${task.priority !== 'N/A' ? `

Priority: ${task.priority}

` : ''} `; listEl.appendChild(item); if (task.unit.toLowerCase() !== firstUnit.toLowerCase()) unitConsistent = false; if (unitConsistent) { totalEstimated += task.estimated; totalActual += task.actual; } totalRatioSum += task.efficiencyRatio; }); const avgEfficiency = totalRatioSum / tbeatAssessedTasks.length; overallStatsEl.innerHTML = `Overall Average Efficiency: ${avgEfficiency.toFixed(1)}% (${tbeatAssessedTasks.length} tasks assessed).`; if (unitConsistent && tbeatAssessedTasks.length > 0) { overallStatsEl.innerHTML += `
Total Estimated: ${totalEstimated.toFixed(1)} ${firstUnit}, Total Actual: ${totalActual.toFixed(1)} ${firstUnit}.`; } else if (tbeatAssessedTasks.length > 0) { overallStatsEl.innerHTML += `
Units varied across tasks; overall time totals may not be directly comparable.`; } if(pdfSummaryButton) pdfSummaryButton.disabled = false; } function tbeatGetFormattedDateForPDF(dateStr) { if (!dateStr) return "N/A"; const parts = dateStr.split('-'); if (parts.length === 3) { const date = new Date(Date.UTC(parseInt(parts[0]), parseInt(parts[1]) - 1, parseInt(parts[2]))); return date.toLocaleDateString('en-US', { timeZone: 'UTC', year: 'numeric', month: 'long', day: 'numeric' }); } return dateStr; } function tbeatDownloadSummaryPDF() { if (!jsPDF_constructor) { alert("PDF library is not loaded. Cannot generate PDF."); return; } if (tbeatAssessedTasks.length === 0) { alert("No assessments to download. Please assess tasks first."); return; } const doc = new jsPDF_constructor('p', 'pt', 'a4'); const FONT_FAMILY = "helvetica"; const ACCENT_COLOR_HEX = getComputedStyle(document.documentElement).getPropertyValue('--accent-color').trim(); const PRIMARY_TEXT_COLOR_HEX = getComputedStyle(document.documentElement).getPropertyValue('--primary-text').trim(); const SECTION_TITLE_COLOR_HEX = getComputedStyle(document.documentElement).getPropertyValue('--section-title-color').trim(); const BUTTON_TEXT_COLOR_HEX = getComputedStyle(document.documentElement).getPropertyValue('--button-text-color').trim(); let yPos = 40; const pageWidth = doc.internal.pageSize.getWidth(); const margin = 40; const usableWidth = pageWidth - (2 * margin); doc.setFillColor(ACCENT_COLOR_HEX); doc.rect(0, 0, pageWidth, yPos + 10, 'F'); doc.setFont(FONT_FAMILY, "bold"); doc.setFontSize(18); doc.setTextColor(BUTTON_TEXT_COLOR_HEX); doc.text("Task-Based Efficiency Assessment Report", pageWidth / 2, yPos, { align: "center" }); yPos += 25; doc.setFont(FONT_FAMILY, "normal"); doc.setFontSize(10); doc.setTextColor(PRIMARY_TEXT_COLOR_HEX); const assessmentDate = new Date(2025, 4, 17).toLocaleDateString(undefined, { year: 'numeric', month: 'long', day: 'numeric' }); // Context date doc.text(`Assessment Date: ${assessmentDate}`, margin, yPos); yPos += 25; let totalEstimated = 0, totalActual = 0, totalRatioSum = 0; let unitConsistent = true; const firstUnit = tbeatAssessedTasks.length > 0 ? tbeatAssessedTasks[0].unit : "units"; tbeatAssessedTasks.forEach(task => { if (task.unit.toLowerCase() !== firstUnit.toLowerCase()) unitConsistent = false; if (unitConsistent) { totalEstimated += task.estimated; totalActual += task.actual; } totalRatioSum += task.efficiencyRatio; }); const avgEfficiency = tbeatAssessedTasks.length > 0 ? (totalRatioSum / tbeatAssessedTasks.length) : 0; doc.setFont(FONT_FAMILY, "bold"); doc.setFontSize(12); doc.setTextColor(SECTION_TITLE_COLOR_HEX); doc.text("Overall Summary:", margin, yPos); yPos += 15; doc.setFont(FONT_FAMILY, "normal"); doc.setFontSize(10); doc.text(`Total Tasks Assessed: ${tbeatAssessedTasks.length}`, margin, yPos); yPos+=12; doc.text(`Average Efficiency Ratio: ${avgEfficiency.toFixed(1)}%`, margin, yPos); yPos+=12; if (unitConsistent && tbeatAssessedTasks.length > 0) { doc.text(`Total Estimated: ${totalEstimated.toFixed(1)} ${firstUnit}`, margin, yPos); yPos+=12; doc.text(`Total Actual: ${totalActual.toFixed(1)} ${firstUnit}`, margin, yPos); yPos+=12; } else if (tbeatAssessedTasks.length > 0) { doc.text("Note: Units varied; totals not directly comparable.", margin, yPos); yPos+=12; } yPos += 10; doc.setFont(FONT_FAMILY, "bold"); doc.setFontSize(14); doc.setTextColor(SECTION_TITLE_COLOR_HEX); doc.text("Detailed Task Assessments:", margin, yPos); yPos += 20; const addTextSectionToPdf = (title, content, isSub = false) => { if (!content && title) content = "N/A"; // Show N/A for empty reflection fields if (yPos > doc.internal.pageSize.getHeight() - (isSub ? 30 : 60) ) { doc.addPage(); yPos = margin; } doc.setFont(FONT_FAMILY, isSub ? "italic" : "bold"); doc.setFontSize(isSub ? 9 : 10); doc.setTextColor(isSub ? PRIMARY_TEXT_COLOR_HEX : SECTION_TITLE_COLOR_HEX); if (title) { doc.text(title, margin + (isSub ? 10 : 0), yPos); // Indent sub-sections yPos += (isSub ? 11 : 13); } doc.setFont(FONT_FAMILY, "normal"); doc.setFontSize(9); doc.setTextColor(PRIMARY_TEXT_COLOR_HEX); const lines = doc.splitTextToSize(content, usableWidth - (isSub ? 20 : 0)); // Adjust width for indent doc.text(lines, margin + (isSub ? 10 : 0), yPos); yPos += (lines.length * 11) + (isSub ? 4 : 10); }; tbeatAssessedTasks.forEach((task, index) => { if (index > 0) { if (yPos > doc.internal.pageSize.getHeight() - 20 ) { doc.addPage(); yPos = margin; } doc.setDrawColor(doc.internal.theme === 'grid' ? 200 : 0); // Use theme's grid color or black doc.setLineWidth(0.5); doc.line(margin, yPos, pageWidth - margin, yPos); yPos += 10; } if (yPos > doc.internal.pageSize.getHeight() - 200 ) { doc.addPage(); yPos = margin; } doc.setFont(FONT_FAMILY, "bold"); doc.setFontSize(12); doc.setTextColor(ACCENT_COLOR_HEX); doc.text(`Task: ${task.name}`, margin, yPos); yPos += 18; const taskDetailsData = [ ["Estimated:", `${task.estimated.toFixed(1)} ${task.unit}`, "Actual:", `${task.actual.toFixed(1)} ${task.unit}`], ["Variance:", `${task.variance.toFixed(1)} ${task.unit} (${task.variance > 0 ? 'Overran' : (task.variance < 0 ? 'Faster' : 'On Target')})`, "Efficiency:", `${task.efficiencyRatio.toFixed(1)}% (${task.interpretation})`], ]; if (task.complexity !== 'N/A' || task.priority !== 'N/A') { taskDetailsData.push(["Complexity:", task.complexity, "Priority:", task.priority]); } if (jsPDF_autoTable_plugin) { doc.autoTable({ startY: yPos, body: taskDetailsData, theme: 'plain', styles: { font: FONT_FAMILY, fontSize: 9, cellPadding: 2}, columnStyles: { 0: {fontStyle:'bold', cellWidth:80}, 1:{cellWidth:150}, 2:{fontStyle:'bold', cellWidth:80}, 3:{cellWidth:'auto'} }, }); yPos = doc.lastAutoTable.finalY + 10; } else { // Fallback if autoTable is not available taskDetailsData.forEach(row => { let rowText = row.join("\t\t"); // Simple tab separation const lines = doc.splitTextToSize(rowText, usableWidth); doc.text(lines, margin, yPos); yPos += (lines.length * 11) + 2; }); yPos += 5; } addTextSectionToPdf("Positive Influences:", task.positiveFactors, true); addTextSectionToPdf("Negative Impacts/Delays:", task.negativeFactors, true); addTextSectionToPdf("Key Learnings:", task.learnings, true); addTextSectionToPdf("Future Improvement Actions:", task.improvementAction, true); yPos += 8; }); const pageCount = doc.internal.getNumberOfPages(); for (let i = 1; i <= pageCount; i++) { doc.setPage(i); const pageHeight = doc.internal.pageSize.getHeight(); doc.setLineWidth(0.5); doc.setDrawColor(ACCENT_COLOR_HEX); doc.line(margin, pageHeight - 30, pageWidth - margin, pageHeight - 30); doc.setFont(FONT_FAMILY, "normal"); doc.setFontSize(8); doc.setTextColor(PRIMARY_TEXT_COLOR_HEX); doc.text(`Task Efficiency Assessment - Page ${i} of ${pageCount}`, pageWidth / 2, pageHeight - 20, { align: "center" }); } doc.save("Task_Efficiency_Assessment_Summary.pdf"); }
Scroll to Top