/* ============================================================ assessments.js — Assessments listing & assign ============================================================ */ window.Views = window.Views || {}; window.Assessments = {}; Views.assessments = function () { const filters = { q: '', status: '', type: '' }; let table; const stats = { total: DB.assessments.length, completed: DB.assessments.filter(a => a.status === 'Completed').length, pending: DB.assessments.filter(a => ['Pending', 'In Progress'].includes(a.status)).length, avg: Math.round(DB.assessments.filter(a => a.score).reduce((s, a) => s + a.score, 0) / (DB.assessments.filter(a => a.score).length || 1)) }; function apply() { const rows = DB.assessments.filter(a => { if (filters.status && a.status !== filters.status) return false; if (filters.type && a.type !== filters.type) return false; if (filters.q && !(a.candidate + a.jobTitle + a.type).toLowerCase().includes(filters.q.toLowerCase())) return false; return true; }); table.update(rows); } table = UI.dataTable({ pageSize: 8, rows: DB.assessments, columns: [ { key: 'candidate', label: 'Candidate', sortable: true, render: a => `
Coding tests, take-homes, and evaluations
Results will appear once the candidate submits.