-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Leave scores initially unset, and show progress of filling out. Layout
is questionable.
- Loading branch information
1 parent
e53fc23
commit 614fcb9
Showing
4 changed files
with
98 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<script lang="ts"> | ||
import { state, type State } from "../data"; | ||
import { base } from "$app/paths"; | ||
let questions = [ | ||
"Porosity - Walking and Wheeling", | ||
"Porosity - Cycling", | ||
"Crossings - Walking and Wheeling", | ||
"Crossings - Cycling", | ||
"Permeability - Walking and Wheeling", | ||
"Permeability - Cycling", | ||
"Mesh Density - Walking and Wheeling", | ||
"Mesh Density - Cycling", | ||
"Motorised Through-Traffic", | ||
"Perimeter Treatment Design", | ||
"Green Infrastructure Design", | ||
"Other Internal Treatment Design", | ||
"Engagement Practice", | ||
]; | ||
function formatIndex(idx: number): string { | ||
return (idx + 1).toString().padStart(2, "0"); | ||
} | ||
$: completed = getCompleted($state); | ||
function getCompleted(_: State): boolean[] { | ||
return Array.from(Array(questions.length).keys()).map( | ||
(idx) => | ||
$state.existingScores[idx] != "" && $state.proposedScores[idx] != "", | ||
); | ||
} | ||
$: totalExisting = sum($state.existingScores.map((x) => parseInt(x || "0"))); | ||
$: totalProposed = sum($state.proposedScores.map((x) => parseInt(x || "0"))); | ||
function sum(list: number[]): number { | ||
return list.reduce((total, x) => total + x, 0); | ||
} | ||
</script> | ||
|
||
<p>Total existing score: {totalExisting}</p> | ||
<p>Total proposed score: {totalProposed}</p> | ||
|
||
<ol> | ||
{#each questions as label, idx} | ||
<li> | ||
<div style="display: flex; justify-content: space-between"> | ||
<a href="{base}/area_check/scorecard/q{formatIndex(idx)}">{label}</a> | ||
{#if completed[idx]} | ||
<strong class="govuk-tag govuk-tag--green">Done</strong> | ||
{:else} | ||
<strong class="govuk-tag govuk-tag--red">Incomplete</strong> | ||
{/if} | ||
</div> | ||
</li> | ||
{/each} | ||
</ol> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters