diff --git a/compliance/FORMAT.md b/compliance/FORMAT.md index 6f1aef1..b941ca1 100644 --- a/compliance/FORMAT.md +++ b/compliance/FORMAT.md @@ -6,7 +6,7 @@ results are shown over time, and fixes the contract so that **a different plan n The page at `/compliance/` contains no project name, no goal, no firm, no rule and no milestone. It reads all of them from one file. A VIM Flex page, or any other screen, can read the same file and follow the same rules. -- Format name: `openbep-compliance-series`, version `0.3` (draft). 0.2 added three optional counts per role; 0.3 adds the plan's escalation steps and the owner of a failing rule, both optional. Older files still load. +- Format name: `openbep-compliance-series`, version `0.4` (draft). 0.2 added three optional counts per role; 0.3 the plan's escalation steps and the owner of a failing rule; 0.4 an icon per check. All optional. Older files still load. - Example: [example-school.json](example-school.json), simulated, written by `build_example.py`. - Validator: [series.js](series.js), `validateSeries(doc)` returns a list of problems in plain words. The page runs it on every file and refuses a file that fails, with the reasons. @@ -42,8 +42,10 @@ plan roles[] { code, role, firm, document, from } from = null, or the date the role joins escalation[] the plan's steps when a firm misses milestones in a row, in order (optional, 0.3) model { server, project, source, schedule, cadenceDays (7 when absent) } -valueChecks[] { id, goal, label } -rules[] { id, goal, label, limit, unit, limitText, direction } +valueChecks[] { id, goal, label, icon } +rules[] { id, goal, label, limit, unit, limitText, direction, icon } + icon (optional, 0.4): one of value, code, material, fire, asset, room, workset, name, level, + clash, warning, duplicate. Anything else, or none, shows the icon of the kind of check. direction: lowerIsBetter | higherIsBetter versions[] in order order, label, tag, created, milestone (the one in force), uploadedBy[] (role codes) @@ -86,6 +88,8 @@ versions[] in order | Open since | first version of the current unbroken run of that deficiency | | Closes at this pace | size ÷ pace of the last four working periods, counted forward skipping holidays | | Urgency | Overdue: open through a milestone it should have met. Will miss: closes after the milestone, or never. On course: closes in time. | +| Severity | Required values: points below the target. Critical 15 or more, major 5 to 15, minor under 5. A rule in %: the same, in points from its limit. A counted rule: critical at half its limit or more beyond it, major from a tenth; with a limit of 0, critical from 10, major from 3. | +| Payment check | Per firm, four conditions: its model was uploaded and checked in the latest working period; its own compliance is at the target; no model rule fails on its elements; nothing of its own is overdue. A rule not split by firm holds no single firm. The contract decides payment. | | Step set by the plan | milestones a firm missed in a row on its own elements, read against `plan.escalation` | | New elements arrive filled | newMet ÷ newRequired over the last four working periods | @@ -97,6 +101,10 @@ versions[] in order Then the active deficiencies, grouped by firm or all together, most urgent first, each with its owner, size, age, pace and closing date. Then one accountability row per firm: milestones met and missed, missed in a row, the plan's step, what is open now. + Then one payment card per firm: the four conditions, met or missing. + Every deficiency carries the same graphics: severity bars, the icon of its check, a bar of size against + the target or limit, a trend line with an arrow, and a timeline (opened, this version, milestone, closing date). + The milestones are also drawn as one track. 2. Overall compliance over time, with the stepped target, milestones, holidays and unchecked versions; the same chart in values shows what the plan requires against what is filled. 3. One row per role: compliance, wrong and empty, pace, how clean new elements arrive, needed pace, uploads. diff --git a/compliance/build_example.py b/compliance/build_example.py index 85d0593..ae63516 100644 --- a/compliance/build_example.py +++ b/compliance/build_example.py @@ -39,22 +39,22 @@ # Value checks: required values that must be filled with a real value. k = required values per element, by role. # lag < 1 means the role fills this check later than its other work. VALUE_CHECKS = [ - {'id': 'assembly-code', 'goal': 'cost', 'label': 'Assembly Code filled', 'k': {'ARCH': 1, 'STRUCT': 1, 'MECH': 1, 'CON': .2}, 'lag': {'MECH': .85}}, - {'id': 'real-material', 'goal': 'cost', 'label': 'Elements with a real material', 'k': {'ARCH': 1, 'STRUCT': 1}, 'lag': {'ARCH': .9}}, - {'id': 'lod-params', 'goal': 'change', 'label': 'Parameters required by the LOD matrix at this milestone', 'k': {'ARCH': 2.2, 'STRUCT': 2.6, 'MECH': 2.0, 'CON': .5}, 'lag': {}}, - {'id': 'fire-rating', 'goal': 'change', 'label': 'Fire rating on walls, doors and floors', 'k': {'ARCH': .35, 'STRUCT': .2}, 'lag': {'ARCH': 1.05}}, - {'id': 'asset-data', 'goal': 'handover', 'label': 'Equipment asset data (OB_ asset parameters)', 'k': {'MECH': 1.6, 'ARCH': .15, 'CON': 3.0}, 'lag': {'MECH': .55, 'ARCH': .7, 'CON': .8}}, - {'id': 'rooms', 'goal': 'handover', 'label': 'Rooms numbered and named by the plan', 'k': {'ARCH': .12}, 'lag': {'ARCH': 1.1}}, - {'id': 'worksets', 'goal': 'basics', 'label': 'Elements on a named workset', 'k': {'ARCH': 1, 'STRUCT': 1, 'MECH': 1, 'CON': 1}, 'lag': {'ARCH': 1.15, 'STRUCT': 1.2, 'MECH': 1.1, 'CON': 1.2}}, - {'id': 'view-names', 'goal': 'basics', 'label': 'Views named by the naming rules', 'k': {'ARCH': .06, 'STRUCT': .05, 'MECH': .05, 'CON': .03}, 'lag': {'MECH': .8}}, + {'id': 'assembly-code', 'icon': 'code', 'goal': 'cost', 'label': 'Assembly Code filled', 'k': {'ARCH': 1, 'STRUCT': 1, 'MECH': 1, 'CON': .2}, 'lag': {'MECH': .85}}, + {'id': 'real-material', 'icon': 'material', 'goal': 'cost', 'label': 'Elements with a real material', 'k': {'ARCH': 1, 'STRUCT': 1}, 'lag': {'ARCH': .9}}, + {'id': 'lod-params', 'icon': 'value', 'goal': 'change', 'label': 'Parameters required by the LOD matrix at this milestone', 'k': {'ARCH': 2.2, 'STRUCT': 2.6, 'MECH': 2.0, 'CON': .5}, 'lag': {}}, + {'id': 'fire-rating', 'icon': 'fire', 'goal': 'change', 'label': 'Fire rating on walls, doors and floors', 'k': {'ARCH': .35, 'STRUCT': .2}, 'lag': {'ARCH': 1.05}}, + {'id': 'asset-data', 'icon': 'asset', 'goal': 'handover', 'label': 'Equipment asset data (OB_ asset parameters)', 'k': {'MECH': 1.6, 'ARCH': .15, 'CON': 3.0}, 'lag': {'MECH': .55, 'ARCH': .7, 'CON': .8}}, + {'id': 'rooms', 'icon': 'room', 'goal': 'handover', 'label': 'Rooms numbered and named by the plan', 'k': {'ARCH': .12}, 'lag': {'ARCH': 1.1}}, + {'id': 'worksets', 'icon': 'workset', 'goal': 'basics', 'label': 'Elements on a named workset', 'k': {'ARCH': 1, 'STRUCT': 1, 'MECH': 1, 'CON': 1}, 'lag': {'ARCH': 1.15, 'STRUCT': 1.2, 'MECH': 1.1, 'CON': 1.2}}, + {'id': 'view-names', 'icon': 'name', 'goal': 'basics', 'label': 'Views named by the naming rules', 'k': {'ARCH': .06, 'STRUCT': .05, 'MECH': .05, 'CON': .03}, 'lag': {'MECH': .8}}, ] RULES = [ - {'id': 'on-level', 'goal': 'cost', 'label': 'Elements on a level', 'limit': 95, 'unit': '%', 'limitText': 'at least 95 %', 'direction': 'higherIsBetter'}, - {'id': 'clashes', 'goal': 'change', 'label': 'Clashes open for more than one coordination cycle', 'limit': 25, 'unit': '', 'limitText': 'at most 25', 'direction': 'lowerIsBetter'}, - {'id': 'warnings', 'goal': 'change', 'label': 'Revit warnings', 'limit': 1500, 'unit': '', 'limitText': 'at most 1,500', 'direction': 'lowerIsBetter'}, - {'id': 'dup-mark', 'goal': 'handover', 'label': 'No duplicate Mark', 'limit': 0, 'unit': '', 'limitText': 'limit 0', 'direction': 'lowerIsBetter'}, - {'id': 'worksets-exist', 'goal': 'basics', 'label': 'The named worksets exist', 'limit': 0, 'unit': '', 'limitText': 'limit 0 missing', 'direction': 'lowerIsBetter'}, - {'id': 'dup-levels', 'goal': 'basics', 'label': 'Duplicate levels', 'limit': 0, 'unit': '', 'limitText': 'limit 0', 'direction': 'lowerIsBetter'}, + {'id': 'on-level', 'icon': 'level', 'goal': 'cost', 'label': 'Elements on a level', 'limit': 95, 'unit': '%', 'limitText': 'at least 95 %', 'direction': 'higherIsBetter'}, + {'id': 'clashes', 'icon': 'clash', 'goal': 'change', 'label': 'Clashes open for more than one coordination cycle', 'limit': 25, 'unit': '', 'limitText': 'at most 25', 'direction': 'lowerIsBetter'}, + {'id': 'warnings', 'icon': 'warning', 'goal': 'change', 'label': 'Revit warnings', 'limit': 1500, 'unit': '', 'limitText': 'at most 1,500', 'direction': 'lowerIsBetter'}, + {'id': 'dup-mark', 'icon': 'duplicate', 'goal': 'handover', 'label': 'No duplicate Mark', 'limit': 0, 'unit': '', 'limitText': 'limit 0', 'direction': 'lowerIsBetter'}, + {'id': 'worksets-exist', 'icon': 'workset', 'goal': 'basics', 'label': 'The named worksets exist', 'limit': 0, 'unit': '', 'limitText': 'limit 0 missing', 'direction': 'lowerIsBetter'}, + {'id': 'dup-levels', 'icon': 'level', 'goal': 'basics', 'label': 'Duplicate levels', 'limit': 0, 'unit': '', 'limitText': 'limit 0', 'direction': 'lowerIsBetter'}, ] D = date.fromisoformat @@ -201,13 +201,13 @@ def rule_values(day, i): versions.append(v) doc = { - 'format': 'openbep-compliance-series', 'formatVersion': '0.3', 'example': True, + 'format': 'openbep-compliance-series', 'formatVersion': '0.4', 'example': True, 'note': 'SIMULATED. Invented numbers for a made-up school project. No real model, firm or VIM Server was measured. Written by compliance/build_example.py.', 'plan': {'name': 'Example: Primary school renovation and extension', 'owner': 'School service centre (example)', 'delivery': 'Design-bid-build', 'goals': GOALS, 'milestones': MILESTONES, 'holidays': HOLIDAYS, 'roles': ROLES, 'escalation': ESCALATION}, 'model': {'server': 'VIM Server (simulated)', 'project': 'Primary school (example)', 'source': 'SCH-FEDERATED.vim', 'schedule': 'One version every Friday, built from the Revit models each firm uploaded that week.'}, - 'valueChecks': [{k: v for k, v in vc.items() if k in ('id', 'goal', 'label')} for vc in VALUE_CHECKS], + 'valueChecks': [{k: v for k, v in vc.items() if k in ('id', 'goal', 'label', 'icon')} for vc in VALUE_CHECKS], 'rules': RULES, 'versions': versions, } diff --git a/compliance/example-school.json b/compliance/example-school.json index ffce241..8f3bc69 100644 --- a/compliance/example-school.json +++ b/compliance/example-school.json @@ -1,6 +1,6 @@ { "format": "openbep-compliance-series", - "formatVersion": "0.3", + "formatVersion": "0.4", "example": true, "note": "SIMULATED. Invented numbers for a made-up school project. No real model, firm or VIM Server was measured. Written by compliance/build_example.py.", "plan": { @@ -118,41 +118,49 @@ "valueChecks": [ { "id": "assembly-code", + "icon": "code", "goal": "cost", "label": "Assembly Code filled" }, { "id": "real-material", + "icon": "material", "goal": "cost", "label": "Elements with a real material" }, { "id": "lod-params", + "icon": "value", "goal": "change", "label": "Parameters required by the LOD matrix at this milestone" }, { "id": "fire-rating", + "icon": "fire", "goal": "change", "label": "Fire rating on walls, doors and floors" }, { "id": "asset-data", + "icon": "asset", "goal": "handover", "label": "Equipment asset data (OB_ asset parameters)" }, { "id": "rooms", + "icon": "room", "goal": "handover", "label": "Rooms numbered and named by the plan" }, { "id": "worksets", + "icon": "workset", "goal": "basics", "label": "Elements on a named workset" }, { "id": "view-names", + "icon": "name", "goal": "basics", "label": "Views named by the naming rules" } @@ -160,6 +168,7 @@ "rules": [ { "id": "on-level", + "icon": "level", "goal": "cost", "label": "Elements on a level", "limit": 95, @@ -169,6 +178,7 @@ }, { "id": "clashes", + "icon": "clash", "goal": "change", "label": "Clashes open for more than one coordination cycle", "limit": 25, @@ -178,6 +188,7 @@ }, { "id": "warnings", + "icon": "warning", "goal": "change", "label": "Revit warnings", "limit": 1500, @@ -187,6 +198,7 @@ }, { "id": "dup-mark", + "icon": "duplicate", "goal": "handover", "label": "No duplicate Mark", "limit": 0, @@ -196,6 +208,7 @@ }, { "id": "worksets-exist", + "icon": "workset", "goal": "basics", "label": "The named worksets exist", "limit": 0, @@ -205,6 +218,7 @@ }, { "id": "dup-levels", + "icon": "level", "goal": "basics", "label": "Duplicate levels", "limit": 0, diff --git a/compliance/index.html b/compliance/index.html index 139af67..af917d2 100644 --- a/compliance/index.html +++ b/compliance/index.html @@ -167,13 +167,37 @@ .msgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:12px} .msc{background:var(--surface);border:1px solid var(--line);border-top:4px solid var(--line2);border-radius:var(--r-md);padding:12px 14px;display:flex;flex-direction:column;gap:6px;min-width:0} .msc.pass{border-top-color:var(--good)}.msc.miss{border-top-color:var(--bad)}.msc.now{border-top-color:var(--accent)} -.msc .mn{display:flex;gap:8px;align-items:baseline}.msc .mn i{font-style:normal;font-family:var(--mono);font-size:12px;border:1px solid var(--line2);border-radius:50%;width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;flex:none} +.msc .mn{display:flex;gap:8px;align-items:baseline}.msc .mn>i{font-style:normal;font-family:var(--mono);font-size:12px;border:1px solid var(--line2);border-radius:50%;width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;flex:none} .msc .md{font-size:12px;color:var(--muted)} .msc .mv{font-size:22px;font-weight:700}.msc .mv small{font-size:13px;font-weight:400;color:var(--muted)} .msc ul{list-style:none;margin:0;padding:0;font-size:12px;display:flex;flex-direction:column;gap:3px} .msc .who{display:flex;flex-wrap:wrap;gap:4px;align-items:center;font-size:12px} .msc .btn{align-self:flex-start;margin-top:auto} .fblock{margin-bottom:14px;min-width:0}.fh{display:flex;flex-wrap:wrap;gap:6px 16px;align-items:center;justify-content:space-between;padding:8px 2px}.fh .md{color:var(--muted);font-size:12px}.fs{display:flex;flex-wrap:wrap;gap:6px 14px;align-items:center;font-size:13px} +.ico{width:16px;height:16px;flex:none;stroke:currentColor;fill:none;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round} +.ib{width:28px;height:28px;border-radius:var(--r-md);background:var(--sunk);display:inline-flex;align-items:center;justify-content:center;flex:none;color:var(--muted)} +.ib.ok{background:var(--good-soft);color:var(--good)}.ib.no{background:var(--bad-soft);color:var(--bad)} +.dl{display:flex;gap:8px;align-items:flex-start;min-width:180px} +.sev{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:700;white-space:nowrap} +.sev svg{flex:none}.sev rect{fill:var(--line2)}.sev.s0 rect.on{fill:var(--bad)}.sev.s1 rect.on{fill:var(--warn)}.sev.s2 rect.on{fill:var(--faint)} +.tl{display:block;width:220px;max-width:100%;height:auto} +.tl .base{stroke:var(--line2);stroke-width:2}.tl .age{stroke-width:6}.tl .u0{stroke:var(--bad)}.tl .u1{stroke:var(--warn)}.tl .u2{stroke:var(--good)} +.tl .proj{stroke-width:2;stroke-dasharray:3 3}.tl .today{stroke:var(--ink);stroke-width:1.5}.tl .msd{fill:var(--surface);stroke:var(--ink);stroke-width:1.5} +.trend{display:inline-flex;flex-wrap:wrap;align-items:center;gap:4px 8px;font-size:12px} +.segs{display:flex;gap:3px}.segs i{flex:1;height:6px;border-radius:2px;max-width:60px}.segs .u0{background:var(--bad)}.segs .u1{background:var(--warn)}.segs .u2{background:var(--good)} +.msdots{display:inline-flex;gap:3px;vertical-align:middle}.msdots i{font-style:normal;width:18px;height:18px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;color:var(--surface)}.msdots .ok{background:var(--good)}.msdots .no{background:var(--bad)} +.steplad{display:inline-flex;align-items:flex-end;gap:2px;margin-right:6px;vertical-align:middle}.steplad i{width:6px;background:var(--line2);border-radius:1px}.steplad i.on{background:var(--bad)}.steplad i:nth-child(1){height:6px}.steplad i:nth-child(2){height:10px}.steplad i:nth-child(3){height:14px}.steplad i:nth-child(n+4){height:18px} +.msc ul.cond{font-size:13px;gap:8px}.cond li{display:grid;grid-template-columns:auto minmax(0,1fr);gap:8px;align-items:start}.cond b{font-weight:500}.cond small{display:block;color:var(--muted);font-size:12px} +.steps{list-style:none;margin:0;padding:34px 28px 10px;display:grid;grid-auto-flow:column;grid-auto-columns:minmax(124px,1fr)} +.steps li{position:relative;text-align:center;font-size:12px;color:var(--muted);padding:0 6px;display:flex;flex-direction:column;align-items:center;gap:1px} +.steps li:before{content:'';position:absolute;top:10px;left:-50%;width:100%;height:3px;background:var(--line2)} +.steps li:first-child:before{left:0;width:50%} +.steps li.pass:before,.steps li.miss:before{background:var(--faint)} +.steps li.now:before{background:linear-gradient(90deg,var(--faint) var(--p),var(--line2) var(--p))} +.steps .nd{position:relative;z-index:1;width:22px;height:22px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;background:var(--surface);border:2px solid var(--line2);margin-bottom:3px} +.steps .pass .nd{background:var(--good);border-color:var(--good);color:var(--surface)}.steps .miss .nd{background:var(--bad);border-color:var(--bad);color:var(--surface)}.steps .now .nd{border-color:var(--accent);color:var(--accent-ink)} +.steps b{color:var(--ink);font-weight:500} +.steps .td{position:absolute;top:-28px;transform:translateX(-50%);font-size:10px;color:var(--ink);white-space:nowrap;line-height:1.15;z-index:2} .rules{margin:8px 0 0;padding-left:18px;font-size:13px;color:var(--muted);max-width:100ch}.rules li{margin:2px 0}.rules b{color:var(--ink)} td small.sm{display:block;color:var(--muted);font-size:12px} .seg{display:inline-flex}.seg .btn{border-radius:0;margin-left:-1px}.seg .btn:first-child{border-radius:var(--r-sm) 0 0 var(--r-sm);margin-left:0}.seg .btn:last-child{border-radius:0 var(--r-sm) var(--r-sm) 0} @@ -207,7 +231,7 @@ .pace thead{display:none}.pace table,.pace tbody{display:block} .pace tr{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px 12px;padding:12px;border-bottom:1px solid var(--line)} .pace td{display:block;border:0;padding:0;text-align:left!important;min-width:0} - .pace td:first-child{grid-column:1/-1} + .pace td:first-child,.pace td.full{grid-column:1/-1} .pace td[data-l]:before{content:attr(data-l);display:block;font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);margin-bottom:2px} .mx .rh{min-width:170px;max-width:200px} } @@ -253,6 +277,7 @@

Major milestones

What the model had to reach at each milestone, and what it reached. Seen from the version selected above.
+
    @@ -268,6 +293,12 @@
    +
    +

    Payment check

    +
    + +
    +

    Overall compliance

    Share of the values the plan requires that are filled, in every element of every firm's model. The dashed line is the target of the milestone in force.
    @@ -317,7 +348,8 @@

    How the numbers are worked out

  1. Wrong or empty: a required value that does not meet the plan is either empty or holds something that is not a real value (a placeholder such as "TBD", or a value outside the allowed list). The two need different fixes, so they are counted apart.
  2. New elements arrive filled: of the values required on elements a firm added in its last four working weeks, the share that was already filled. A firm that fills as it models stays high; a firm that models first and fills later does not, and its backlog grows.
  3. Milestones: a milestone is judged on the last version checked on or before its date. It passes when overall compliance reaches its target and every model rule passes.
  4. -
  5. Deficiencies: one line for each value check of a firm that is below the target, and one for each failing model rule. "Open since" is the first version of the current unbroken run. "Closes at this pace" projects the last four working weeks forward, skipping holidays.
  6. +
  7. Deficiencies: one line for each value check of a firm that is below the target, and one for each failing model rule. It is open since the first version of its current unbroken run. The closing date projects the last four working weeks forward, skipping holidays. Severity says how far off it is; urgency says whether time is running out.
  8. +
  9. Payment check: four conditions per firm, the same for every plan: its model was uploaded and checked in the latest period, its own compliance is at the target, no model rule fails on its elements, and nothing is overdue from an earlier milestone. The card lists what is missing. A rule the checker does not split by firm holds no single firm.
  10. Step set by the plan: counted in milestones a firm missed in a row on its own elements. The steps are the plan's own wording; this page adds none. With no steps in the plan, the column is left out.
  11. Holidays: weeks inside the agreed holidays in the plan have no version and are left out of every count, as on the Scorecard. They never count as a slow week.
  12. A gap is never a zero: a version that could not be checked keeps its place with the reason, and the line breaks there.
  13. @@ -419,7 +451,7 @@

    How the numbers are worked out

    function urlState(){const u=new URLSearchParams(location.search);u.set('v',V[sel].order);if(cmp>=0&&cmp!==prevChecked(sel)) u.set('cmp',V[cmp].order);else u.delete('cmp');if(F) u.set('firm',F);else u.delete('firm');history.replaceState(null,'','?'+u); $('#printHead').textContent=`${D.plan.name} · ${V[sel].label}, ${dLong(dayOf(V[sel]))}${F?' · '+F+' only':''}${D.example?' · EXAMPLE DATA, SIMULATED':''}`} -function render(){urlState();gate();milestones();gaps();tiles();drawOverall();overallTable();pace();strip();goals();changed();matrix()} +function render(){urlState();gate();msTrack();milestones();gaps();tiles();drawOverall();overallTable();pace();strip();goals();changed();matrix()} /* ---------- gate and gaps ---------- */ function gate(){ @@ -455,53 +487,98 @@

    How the numbers are worked out

    return `
    ${i+1}

    ${esc(m.name)}

    ${dLong(m.date)}
    ${st}
    ${body}
    `}).join(''); $('#msCards').querySelectorAll('[data-i]').forEach(b=>b.onclick=()=>select(+b.dataset.i)); } +// Small line icons. A plan may name one per check (FORMAT.md, "icon"); anything else falls back to the kind of check. +const ICONS={ + value:'', + rule:'', + code:'', + material:'', + fire:'', + asset:'', + room:'', + workset:'', + name:'', + level:'', + clash:'', + warning:'', + duplicate:'', + upload:'', + target:'', + clock:''}; +const ico=n=>``; +const SEV=['Critical','Major','Minor']; +const sevHtml=s=>`${SEV[s]}`; // Every open deficiency at the selected version: a value check of one firm below the target, or a failing model rule. -function deficiencies(){ +function deficiencies(all){ + const f=all?null:F; const v=V[sel],m=msOf(v),left=workingWeeks(now(),m.date),j=back(sel,4),wk=j>=0?Math.max(1,workingWeeks(dayOf(V[j]),now())):0,past=MS.filter(msPassed).filter(x=>msVer(x){const h=[];for(let i=sel;i>=0&&h.length<12;i--){if(!checked(V[i])) continue;const x=get(V[i]);if(x==null) break;h.unshift(x)}return h}; const finish=(d,failAt)=>{ // failAt(i): is it open at version i let s0=sel;for(let i=sel-1;i>=0;i--){if(!checked(V[i])) continue;if(failAt(i)) s0=i;else break} d.since=s0;d.weeks=workingWeeks(dayOf(V[s0]),now()); d.missed=past.filter(x=>msVer(x)>=s0&&msVer(x)<=sel&&failAt(msVer(x))&&(x.id!==m.id||left===0)); d.urg=d.missed.length?0:(d.closeW==null||d.closeW>left)?1:2; d.closes=d.closeW==null?null:addWeeks(now(),Math.ceil(d.closeW));out.push(d)}; - for(const vc of D.valueChecks) for(const c of CODES){if(F&&c!==F) continue;const p=vcPair(v,vc.id,c);if(!p) continue; + for(const vc of D.valueChecks) for(const c of CODES){if(f&&c!==f) continue;const p=vcPair(v,vc.id,c);if(!p) continue; const shortBy=Math.ceil(m.targetPercent/100*p[0]-p[1]);if(shortBy<=0) continue; - const pb=j>=0?vcPair(V[j],vc.id,c):null,pace=pb?(p[1]-pb[1])/wk:null; - finish({kind:'v',label:vc.label,goal:vc.goal,owners:[c],size:`${fmt(shortBy)} values short`,sub:`${pct(100*p[1]/p[0])} filled, target ${m.targetPercent} %`,n:shortBy,pace,need:left>0?shortBy/left:null,closeW:pace>0?shortBy/pace:null}, + const pb=j>=0?vcPair(V[j],vc.id,c):null,pace=pb?(p[1]-pb[1])/wk:null,fill=100*p[1]/p[0],gapPt=m.targetPercent-fill; + finish({kind:'v',icon:ICONS[vc.icon]?vc.icon:'value',label:vc.label,goal:vc.goal,owners:[c],size:`${fmt(shortBy)} values short`,sub:`${pct(fill)} filled, target ${m.targetPercent} %`,n:shortBy,pace,need:left>0?shortBy/left:null,closeW:pace>0?shortBy/pace:null, + sev:gapPt>=15?0:gapPt>=5?1:2,bar:{f:fill,t:m.targetPercent},dir:'higherIsBetter',dunit:'pt',delta:pb?fill-100*pb[1]/pb[0]:null,hist:hist(u=>{const q=vcPair(u,vc.id,c);return q?100*q[1]/q[0]:null})}, i=>{const q=vcPair(V[i],vc.id,c);return !!q&&q[1]=0?V[j].rules[r.id]:null,toward=r.direction==='lowerIsBetter'?-1:1,dist=Math.abs(x.value-r.limit),pace=xb?toward*(x.value-xb.value)/wk:null; - finish({kind:'r',label:r.label,goal:r.goal,owners:x.byRole?Object.keys(x.byRole).filter(c=>x.byRole[c]>0):[],by:x.byRole,size:rv(r,x.value),sub:esc(r.limitText),n:Infinity,pace,need:left>0?dist/left:null,closeW:pace>0?dist/pace:null,unit:r.unit==='%'?'pt':''}, + for(const r of D.rules){const x=v.rules[r.id];if(x.pass||!ruleMine(x,f)) continue; + const xb=j>=0?V[j].rules[r.id]:null,toward=r.direction==='lowerIsBetter'?-1:1,dist=Math.abs(x.value-r.limit),pace=xb?toward*(x.value-xb.value)/wk:null,sc=Math.max(x.value,r.limit)*1.15||1; + const sev=r.unit==='%'?(dist>=15?0:dist>=5?1:2):r.limit>0?(dist/r.limit>=.5?0:dist/r.limit>=.1?1:2):(dist>=10?0:dist>=3?1:2); + finish({kind:'r',icon:ICONS[r.icon]?r.icon:'rule',label:r.label,goal:r.goal,owners:x.byRole?Object.keys(x.byRole).filter(c=>x.byRole[c]>0):[],by:x.byRole,size:rv(r,x.value),sub:esc(r.limitText),n:Infinity,pace,need:left>0?dist/left:null,closeW:pace>0?dist/pace:null,unit:r.unit==='%'?'pt':'', + sev,bar:{f:100*x.value/sc,t:100*r.limit/sc},dir:r.direction,dunit:r.unit==='%'?'pt':'',delta:xb?x.value-xb.value:null,hist:hist(u=>u.rules[r.id]?u.rules[r.id].value:null)}, i=>!V[i].rules[r.id].pass)} - return out.sort((a,b)=>a.urg-b.urg||b.n-a.n||b.weeks-a.weeks); + return out.sort((a,b)=>a.urg-b.urg||a.sev-b.sev||b.n-a.n||b.weeks-a.weeks); } let group='f'; const URG=[['bad','✕ Overdue'],['warn','! Will miss the milestone'],['good','✓ On course']]; +// One deficiency on the time axis shared by the whole list: open since, today, the milestone, and where it closes at this pace. +function tline(d,T){ + const W=220,y=11,x=iso=>6+Math.max(0,Math.min(1,(Date.parse(iso)-T.a)/(T.b-T.a)))*(W-14); + const xs=x(dayOf(V[d.since])),xn=x(now()),xm=x(T.m);let proj=''; + if(d.closes){const over=Date.parse(d.closes)>T.b,xc=over?W-4:x(d.closes),col=d.closes>T.m?'var(--warn)':'var(--good)'; + proj=``+(over?``:``)} + else if(d.pace!=null) proj=``; + return ``; +} function gaps(){ - const v=V[sel],m=msOf(v),ds=deficiencies(),n=[0,1,2].map(k=>ds.filter(d=>d.urg===k).length); - $('#defSum').textContent=ds.length?`${ds.length} open at ${v.label}${F?' for '+F:''}: ${n[0]} overdue, ${n[1]} will miss ${m.name}, ${n[2]} on course.`:''; + const v=V[sel],m=msOf(v),ds=deficiencies(),all=F?deficiencies(true):ds,n=[0,1,2].map(k=>ds.filter(d=>d.urg===k).length),ns=[0,1,2].map(k=>ds.filter(d=>d.sev===k).length); + $('#defSum').textContent=ds.length?`${ds.length} open at ${v.label}${F?' for '+F:''}: ${n[0]} overdue, ${n[1]} will miss ${m.name}, ${n[2]} on course. ${ns[0]} critical, ${ns[1]} major, ${ns[2]} minor.`:''; + const a=ds.length?Math.min(...ds.map(d=>Date.parse(dayOf(V[d.since])))):0,end=Math.max(Date.parse(m.date),Date.parse(now())),T={a,b:end+Math.max(28*864e5,.25*(end-a)),m:m.date}; const pv=(d,x)=>x==null?'–':d.kind==='r'&&d.unit==='pt'?x.toFixed(2)+' pt':fmt(x); - const row=d=>`${URG[d.urg][1]}${d.missed.length?`missed at ${d.missed.map(x=>esc(x.name)).join(', ')}`:''} - ${esc(d.label)}${d.kind==='r'?'Model rule':'Required values'} · ${esc((D.plan.goals.find(g=>g.id===d.goal)||{}).name||'')} + const trend=d=>{const b=d.delta==null?'same':better(d.dir,d.delta),col={better:'var(--good)',worse:'var(--bad)',same:'var(--faint)'}[b],ab=d.delta==null?'':d.dunit==='pt'?Math.abs(d.delta).toFixed(1)+' pt':fmt(Math.abs(d.delta)); + return `
    ${spark(d.hist,col)}${d.delta==null?'Not enough versions yet':b==='same'?'= no change':`${arrow(d.delta)} ${ab} ${b}`}
    ${d.pace==null?'':`${d.pace>0?'':d.pace<0?'−':''}${pv(d,Math.abs(d.pace))} a week, `}${d.need==null?'due now':'needs '+pv(d,d.need)}`}; + const row=d=>`${sevHtml(d.sev)}
    ${URG[d.urg][1]}
    ${d.missed.length?`missed at ${d.missed.map(x=>esc(x.name)).join(', ')}`:''} +
    ${ico(d.icon)}${esc(d.label)}${d.kind==='r'?'Model rule':'Required values'} · ${esc((D.plan.goals.find(g=>g.id===d.goal)||{}).name||'')}
    ${d.owners.length?d.owners.map(c=>`${esc(c)}${d.by?' '+fmt(d.by[c]):''}`).join(' '):'Whole model'} - ${d.size}${d.sub} - ${esc(V[d.since].label)}, ${dShort(dayOf(V[d.since]))}${d.weeks} working week${d.weeks===1?'':'s'} - ${d.pace==null?'–':(d.pace>0?'':d.pace<0?'−':'')+pv(d,Math.abs(d.pace))}${d.need==null?'due now':'needs '+pv(d,d.need)} - ${d.closes?dShort(d.closes)+(d.closes.slice(0,4)!==now().slice(0,4)?', '+d.closes.slice(0,4):''):d.pace==null?'Not enough versions yet':'Not at this pace'}`; - const head='UrgencyDeficiencyOwnerSizeOpen sincePace per weekCloses at this pace'; + ${d.size}
    ${d.sub} + ${trend(d)} + ${tline(d,T)}Since ${esc(V[d.since].label)}, ${dShort(dayOf(V[d.since]))} · ${d.weeks} working week${d.weeks===1?'':'s'} · ${d.closes?'closes '+dShort(d.closes)+(d.closes.slice(0,4)!==now().slice(0,4)?', '+d.closes.slice(0,4):''):d.pace==null?'no pace yet':'does not close at this pace'}`; + const head='Severity and urgencyDeficiencyOwnerSizeTrend, last 4 working weeksTimeline'; const tbl=(list,cap)=>{const top=list.slice(0,cap),rest=list.slice(cap);return `
    ${head}${top.map(row).join('')}
    ${rest.length?`
    Show ${rest.length} more
    ${head}${rest.map(row).join('')}
    `:''}
    `}; const none=`

    Nothing open: every check of ${F?esc(F):'every firm'} meets the ${m.targetPercent} % target and every model rule passes at this version.

    `; if(!ds.length) $('#gaps').innerHTML=none; else if(group==='u') $('#gaps').innerHTML=tbl(ds,8); else{ // one block per firm, the firm with the most urgent load first; a rule owned by two firms shows under both - const blocks=ROLES.filter(r=>v.byRole[r.code]&&(!F||r.code===F)).map(ro=>{const c=ro.code,mine=ds.filter(d=>d.owners.includes(c)).map(d=>d.by?{...d,owners:[c]}:d),k=[0,1,2].map(q=>mine.filter(d=>d.urg===q).length);return {ro,c,mine,k,p:roleP(v,c)}}) + const j=back(sel,4); + const blocks=ROLES.filter(r=>v.byRole[r.code]&&(!F||r.code===F)).map(ro=>{const c=ro.code,mine=ds.filter(d=>d.owners.includes(c)).map(d=>d.by?{...d,owners:[c]}:d),k=[0,1,2].map(q=>mine.filter(d=>d.urg===q).length); + const h=[];for(let i=sel;i>=0&&h.length<12;i--) if(checked(V[i])&&V[i].byRole[c]) h.unshift(roleP(V[i],c)); + return {ro,c,mine,k,p:roleP(v,c),h,dl:j>=0&&V[j].byRole[c]?roleP(v,c)-roleP(V[j],c):null}}) .sort((a,b)=>b.k[0]-a.k[0]||b.k[1]-a.k[1]||b.mine.length-a.mine.length); const whole=ds.filter(d=>!d.owners.length); - $('#gaps').innerHTML=blocks.map(b=>`
    ${esc(b.c)} ${esc(b.ro.role)} ${esc(b.ro.firm||'')}Own compliance ${pct(b.p)} against ${m.targetPercent} %${b.mine.length} open${b.k[0]?`✕ ${b.k[0]} overdue`:''}${b.k[1]?`! ${b.k[1]} will miss`:''}${b.k[2]?`✓ ${b.k[2]} on course`:''}
    ${b.mine.length?tbl(b.mine,5):'

    Nothing open for this firm at this version.

    '}
    `).join('') + $('#gaps').innerHTML=blocks.map(b=>{const bw=b.dl==null?'same':better('higherIsBetter',Math.round(b.dl*10)/10); + return `
    ${esc(b.c)} ${esc(b.ro.role)} ${esc(b.ro.firm||'')}${spark(b.h,fc(b.c))}Own compliance ${pct(b.p)} against ${m.targetPercent} %${b.dl==null?'':`${bw==='same'?'= no change':`${arrow(b.dl)} ${Math.abs(b.dl).toFixed(1)} pt in 4 working weeks`}`}${b.mine.length} open${b.k[0]?`✕ ${b.k[0]} overdue`:''}${b.k[1]?`! ${b.k[1]} will miss`:''}${b.k[2]?`✓ ${b.k[2]} on course`:''}
    ${b.mine.length?tbl(b.mine,5):'

    Nothing open for this firm at this version.

    '}
    `}).join('') +(whole.length?`
    Whole model rules the checker does not split by firm
    ${tbl(whole,5)}
    `:''); } - $('#defKey').innerHTML=`
  14. Overdue: still open after a milestone it should have met.
  15. Will miss the milestone: at the pace of the last four working weeks it closes after ${esc(m.name)} (${dShort(m.date)}), or not at all.
  16. On course: at that pace it closes in time.
  17. Owner: the firm whose elements carry the deficiency. For a model rule, the number beside the code is how many of its elements fail.
  18. `; - accountability(ds); + $('#defKey').innerHTML=`
  19. Severity is how far off: ${sevHtml(0)} 15 points or more below the target, ${sevHtml(1)} 5 to 15 points, ${sevHtml(2)} less than 5. A counted model rule is critical at half its limit or more beyond the limit, major from a tenth; with a limit of 0, critical from 10 and major from 3.
  20. +
  21. Urgency is about time. Overdue: still open after a milestone it should have met. Will miss the milestone: at the pace of the last four working weeks it closes after ${esc(m.name)} (${dShort(m.date)}), or not at all. On course: it closes in time.
  22. +
  23. Timeline: the thick bar runs from the version where the deficiency opened to this version (the upright line). The diamond is ${esc(m.name)}. The dashed line runs to the date it closes at this pace: a dot when that date is on the line, an arrow when it is further out, a cross when it does not close. A red triangle marks a milestone it was open through. Every line uses the same dates.
  24. +
  25. Trend: the small line is the last twelve checked versions; the arrow compares with four working weeks ago. For required values the line is the share filled, so it drops when a milestone starts asking for more.
  26. +
  27. Icon: the kind of check, named by the plan. Owner: the firm whose elements carry the deficiency. For a model rule, the number beside the code is how many of its elements fail.
  28. `; + accountability(all);payment(all); } function accountability(ds){ const v=V[sel],esc2=D.plan.escalation||[],past=MS.filter(msPassed); @@ -511,13 +588,42 @@

    How the numbers are worked out

    const mine=ds.filter(d=>d.owners.includes(c)),k=[0,1,2].map(q=>mine.filter(d=>d.urg===q).length),old=mine.slice().sort((a,b)=>b.weeks-a.weeks)[0]; const step=!esc2.length?null:run===0?'No step: last milestone met':`Step ${Math.min(run,esc2.length)}: ${esc(esc2[Math.min(run,esc2.length)-1])}`; return `
    ${esc(c)} ${esc(ro.role)}${esc(ro.firm||'')}
    - ${rec.length?`${rec.filter(q=>q.ok).length} of ${rec.length}${rec.filter(q=>!q.ok).map(q=>`Missed ${esc(q.x.name)}: ${pct(q.p,0)} against ${q.x.targetPercent} %`).join('')}`:'None due yet'} + ${rec.length?` ${rec.filter(q=>q.ok).length} of ${rec.length}${rec.filter(q=>!q.ok).map(q=>`Missed ${esc(q.x.name)}: ${pct(q.p,0)} against ${q.x.targetPercent} %`).join('')}`:'None due yet'} ${run} - ${esc2.length?`${run?`${step}`:step}`:''} - ${mine.length?`${mine.length}${k[0]} overdue · ${k[1]} will miss · ${k[2]} on course`:'✓ Nothing open'} + ${esc2.length?`${run?`${step}`:step}`:''} + ${mine.length?`${mine.length}${k[0]} overdue · ${k[1]} will miss · ${k[2]} on course`:'✓ Nothing open'} ${old?`${esc(old.label)}${old.weeks} working week${old.weeks===1?'':'s'}, since ${esc(V[old.since].label)}`:'–'}`}).join(''); $('#acc').innerHTML=`${esc2.length?'':''}${rows}
    FirmMilestones metMissed in a rowStep set by the planOpen nowOldest open
    `; } +// What each firm still has to close before its payment claim for the milestone in force is valid under the plan. +function payment(ds){ + const v=V[sel],m=msOf(v),whole=D.rules.filter(q=>!v.rules[q.id].pass&&!v.rules[q.id].byRole); + $('#paySub').textContent=`What each firm still has to close before its payment claim for ${m.name} is valid under the plan, as the model stands at ${v.label}.`; + $('#pay').innerHTML=ROLES.filter(r=>v.byRole[r.code]&&(!F||r.code===F)).map(ro=>{const c=ro.code,r=v.byRole[c]; + let lu=-1;for(let i=sel;i>=0;i--) if(checked(V[i])?V[i].byRole[c]&&V[i].byRole[c].uploaded:V[i].uploadedBy.includes(c)){lu=i;break} + const ago=lu<0?null:workingWeeks(dayOf(V[lu]),now()),short=Math.max(0,Math.ceil(m.targetPercent/100*r.required-r.met)); + const fr=D.rules.filter(q=>{const x=v.rules[q.id];return !x.pass&&x.byRole&&x.byRole[c]>0}),od=ds.filter(d=>d.owners.includes(c)&&d.urg===0); + const conds=[ + {ic:'upload',t:'Its model was uploaded and checked',ok:lu>=0&&ago<=1,d:lu<0?'No upload yet':`Last upload ${esc(V[lu].label)}, ${dShort(dayOf(V[lu]))}${ago>1?`, ${ago} working weeks ago`:''}`}, + {ic:'target',t:`Its own compliance is at the ${m.targetPercent} % target`,ok:short===0,d:short?`${fmt(short)} values short, now ${pct(roleP(v,c))}`:`Now ${pct(roleP(v,c))}`}, + {ic:'rule',t:'No model rule fails on its elements',ok:!fr.length,d:fr.length?fr.map(q=>`${esc(q.label)}: ${fmt(v.rules[q.id].byRole[c])}`).join(' · '):D.rules.length?'None of its elements fail a rule':'The plan has no model rules'}, + {ic:'clock',t:'Nothing is overdue from an earlier milestone',ok:!od.length,d:od.length?`${od.length} overdue: ${od.map(d=>esc(d.label)).join(' · ')}`:'Nothing overdue'}],nOk=conds.filter(q=>q.ok).length,ok=nOk===conds.length; + return `
    ${esc(c)}

    ${esc(ro.role)}

    ${esc(ro.firm||'')}
    +
    ${ok?'✓ Claim can be released':`✕ Held: ${conds.length-nOk} of ${conds.length} missing`}
    + +
      ${conds.map(q=>`
    • ${ico(q.ic)}${q.ok?'✓':'✕'} ${q.t}${q.d}
    • `).join('')}
    + ${whole.length?`
    Not split by firm, so it holds no single firm: ${whole.map(q=>esc(q.label)).join(' · ')}
    `:''}
    `}).join(''); +} +// The milestones as one track: passed, missed, the one in force, and those to come, with this version's date on it. +function msTrack(){ + const cur=msOf(V[sel]); + $('#msTrack').style.minWidth=MS.length*124+56+'px'; + $('#msTrack').innerHTML=MS.map((m,i)=>{const k=msVer(m),passed=msPassed(m),isCur=m.id===cur.id,u=passed?V[k]:isCur?V[sel]:null,o=u?overall(u):null; + const ok=u&&o!=null&&o>=m.targetPercent&&D.rules.every(r=>u.rules[r.id].pass),cls=passed?(ok?'pass':'miss'):isCur?'now':'todo'; + const prev=i?MS[i-1].date:dayOf(V[0]),p=m.date>prev?Math.max(0,Math.min(1,(Date.parse(now())-Date.parse(prev))/(Date.parse(m.date)-Date.parse(prev)))):1; + const here=isCur&&!passed?`${dShort(now())}
    ▼
    `:''; + return `
  29. ${here}${passed?(ok?'✓':'✕'):i+1}${esc(m.name)}${dShort(m.date)}${m.date.slice(0,4)!==now().slice(0,4)?', '+m.date.slice(0,4):''}${o!=null?pct(o,0)+' / ':'target '}${m.targetPercent} %${passed?(ok?'Passed':'Missed'):isCur?'In force':'To come'}
  30. `}).join(''); +} /* ---------- tiles ---------- */ function forecast(i){ @@ -745,8 +851,8 @@

    How the numbers are worked out

    el.querySelectorAll('[data-i]').forEach(c=>c.onclick=()=>select(+c.dataset.i,true)); if(!el.dataset.init){el.dataset.init=1;el.scrollLeft=el.scrollWidth}else el.scrollLeft=keep; } -function spark(vals){if(vals.length<2) return '';const w=90,h=22,mn=Math.min(...vals),mx=Math.max(...vals),r=mx-mn||1; - return ``} +function spark(vals,col){if(vals.length<2) return '';const w=90,h=22,mn=Math.min(...vals),mx=Math.max(...vals),r=mx-mn||1,pt=(v,i)=>[(i*(w-6)/(vals.length-1)+3).toFixed(1),(h-3-(v-mn)/r*(h-6)).toFixed(1)],e=pt(vals[vals.length-1],vals.length-1); + return ``} })(); diff --git a/compliance/series.js b/compliance/series.js index 0252d66..ae2e8c9 100644 --- a/compliance/series.js +++ b/compliance/series.js @@ -13,7 +13,7 @@ const need = (ok, msg) => { if (!ok) e.push(msg); return ok; }; if (!need(d && typeof d === 'object', 'The file is not a JSON object.')) return e; need(d.format === 'openbep-compliance-series', 'format must be "openbep-compliance-series".'); - need(typeof d.formatVersion === 'string' && /^0\./.test(d.formatVersion), 'formatVersion must be 0.x (this page reads 0.1 to 0.3).'); + need(typeof d.formatVersion === 'string' && /^0\./.test(d.formatVersion), 'formatVersion must be 0.x (this page reads 0.1 to 0.4).'); const p = d.plan || {}; need(typeof p.name === 'string' && p.name, 'plan.name is missing.'); const goals = Array.isArray(p.goals) ? p.goals : [], ms = Array.isArray(p.milestones) ? p.milestones : [], roles = Array.isArray(p.roles) ? p.roles : []; @@ -28,8 +28,8 @@ (p.holidays || []).forEach((h, i) => need(isDate(h.from) && isDate(h.to) && h.to >= h.from, `plan.holidays[${i}] needs from and to dates, in order.`)); const vcs = Array.isArray(d.valueChecks) ? d.valueChecks : [], rules = Array.isArray(d.rules) ? d.rules : []; const vid = new Set(), rid = new Set(); - vcs.forEach((c, i) => { need(c.id && c.label, `valueChecks[${i}] needs id and label.`); need(gid.has(c.goal), `Value check "${c.label}" names goal "${c.goal}", which is not in plan.goals.`); vid.add(c.id); }); - rules.forEach((r, i) => { need(r.id && r.label, `rules[${i}] needs id and label.`); need(gid.has(r.goal), `Rule "${r.label}" names goal "${r.goal}", which is not in plan.goals.`); need(DIRS.includes(r.direction), `Rule "${r.label}": direction must be lowerIsBetter or higherIsBetter.`); need(isNum(r.limit), `Rule "${r.label}" needs a numeric limit.`); need(typeof r.limitText === 'string' && r.limitText, `Rule "${r.label}" needs limitText (for example "at most 1,500").`); rid.add(r.id); }); + vcs.forEach((c, i) => { need(c.id && c.label, `valueChecks[${i}] needs id and label.`); need(gid.has(c.goal), `Value check "${c.label}" names goal "${c.goal}", which is not in plan.goals.`); need(c.icon == null || typeof c.icon === 'string', `Value check "${c.label}": icon must be a word.`); vid.add(c.id); }); + rules.forEach((r, i) => { need(r.id && r.label, `rules[${i}] needs id and label.`); need(gid.has(r.goal), `Rule "${r.label}" names goal "${r.goal}", which is not in plan.goals.`); need(r.icon == null || typeof r.icon === 'string', `Rule "${r.label}": icon must be a word.`); need(DIRS.includes(r.direction), `Rule "${r.label}": direction must be lowerIsBetter or higherIsBetter.`); need(isNum(r.limit), `Rule "${r.label}" needs a numeric limit.`); need(typeof r.limitText === 'string' && r.limitText, `Rule "${r.label}" needs limitText (for example "at most 1,500").`); rid.add(r.id); }); need(vcs.length, 'valueChecks needs at least one check: compliance is the share of required values filled.'); const vs = Array.isArray(d.versions) ? d.versions : []; if (!need(vs.length, 'versions is empty.')) return e; diff --git a/compliance/test/test_page.js b/compliance/test/test_page.js index b10ac7f..f9999b5 100644 --- a/compliance/test/test_page.js +++ b/compliance/test/test_page.js @@ -80,6 +80,9 @@ const server = http.createServer((req, res) => { await page.goto(`http://127.0.0.1:${port}/compliance/${q}`); await page.waitForFunction(() => document.querySelector('#tiles .tile') || document.querySelector('.err'), null, { timeout: 10000 }); const r = await page.evaluate(() => ({ + pay: document.querySelectorAll('#pay .msc').length, payConds: [...document.querySelectorAll('#pay .msc')].every(c => c.querySelectorAll('.cond li').length === 4), steps: document.querySelectorAll('#msTrack li').length, + defRows: document.querySelectorAll('#gaps tbody tr').length, defGfx: [...document.querySelectorAll('#gaps tbody tr')].every(t => t.querySelector('.sev') && t.querySelector('.tl') && t.querySelector('.ib .ico')), + gapCut: [...document.querySelectorAll('#gaps *, #pay *')].filter(e => { const b = e.getBoundingClientRect(); return innerWidth < 700 && !e.closest('details:not([open])') && b.width && b.right > innerWidth + 1; }).length, err: !!document.querySelector('.err'), goals: document.querySelectorAll('#goals .goal').length, pace: document.querySelectorAll('#paceTbl tbody tr').length, wide: document.documentElement.scrollWidth > innerWidth + 1, ell: [...document.querySelectorAll('main *')].filter(e => e.tagName !== 'SELECT' && e.tagName !== 'OPTION' && !e.closest('svg') && !e.closest('.mx') && !e.matches('.tw') && !e.closest('details') && !e.closest('.stripbox') && !e.closest('#changed') && e.scrollWidth > e.clientWidth + 1 && getComputedStyle(e).overflowX !== 'visible').map(e => e.className || e.tagName).slice(0, 3).join(','), msg: (document.querySelector('.err') || {}).innerText, cut: [...document.querySelectorAll('#paceTbl *')].filter(e => { const b = e.getBoundingClientRect(), t = document.querySelector('#paceTbl').getBoundingClientRect(); return innerWidth < 700 && b.width && b.right > t.right + 1; }).length, wideEl: [...document.querySelectorAll('body *')].filter(e => e.getBoundingClientRect().right > innerWidth + 1 && !e.closest('.mx') && !e.closest('.tw') && !e.closest('.stripbox')).map(e => e.id || e.className || e.tagName).slice(0, 4).join(','), @@ -90,6 +93,10 @@ const server = http.createServer((req, res) => { ok(!r.err, `${k} @${width}: renders ${r.msg || ''}`); ok(r.goals === d.plan.goals.length, `${k} @${width}: one card per goal (${r.goals}/${d.plan.goals.length})`); ok(r.pace === Object.keys(last.byRole).length, `${k} @${width}: one pace row per firm (${r.pace})`); + ok(r.pay === Object.keys(last.byRole).length && r.payConds, `${k} @${width}: one payment check per firm, four conditions each (${r.pay})`); + ok(r.steps === d.plan.milestones.length, `${k} @${width}: one step per milestone on the track (${r.steps})`); + ok(r.defGfx, `${k} @${width}: every deficiency has severity, icon and timeline (${r.defRows} rows)`); + ok(!r.gapCut, `${k} @${width}: deficiencies and payment cards fit the phone (${r.gapCut} past the edge)`); ok(!r.wide, `${k} @${width}: no page-wide horizontal scroll ${r.wideEl}`); ok(!r.ell, `${k} @${width}: nothing clipped ${r.ell}`); ok(!r.cut, `${k} @${width}: pace cards fit the phone (${r.cut} past the edge)`);