Skip to content

Commit

Permalink
Fill out some next steps. #24
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed May 16, 2024
1 parent b7963a9 commit ad9dbce
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/routes/route_check/results_summary/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { base } from "$app/paths";
import { TextArea } from "govuk-svelte";
import { state, type Scorecard } from "../data";
import { getResults, netDifference } from "../results";
import { getResults, netDifference, type ResultCategory } from "../results";
import LevelOfServiceTable from "./LevelOfServiceTable.svelte";
let policyCheckComplete = $state.policyCheck.every(
Expand Down Expand Up @@ -30,6 +30,15 @@
!scorecard.proposedScores.includes("")
);
}
function improveOrReduce(x: ResultCategory, topic: string): string {
// Note Excel treats the same scores as "worse" -- fixing here
if (x.proposed.scorePercent >= x.existing.scorePercent) {
return `The proposed design will likely improve ${topic}`;
} else {
return `The proposed design will likely reduce ${topic}`;
}
}
</script>

<table>
Expand All @@ -53,7 +62,7 @@
{#if !policyCheckComplete}
Complete Policy Check and Policy Conflict Log
{:else if incompletePolicyConflicts > 0}
View Comments in Policy Check and Policy Conflict Log tabs
View Comments in Policy Check and Policy Conflict Log
{:else}
No further action
{/if}
Expand Down Expand Up @@ -88,15 +97,15 @@
<th><a href="{base}/route_check/safety_check">Safety Check</a></th>
<td>{yesNo(safetyCheckComplete)}</td>
<td>{netDifference(results.safetyCheck)}</td>
<td>TODO</td>
<td>{improveOrReduce(results.safetyCheck, "safety")}</td>
</tr>

<tr>
{#if $state.summary.checkType == "street"}
<th><a href="{base}/route_check/street_check">Street Check</a></th>
<td>{yesNo(isScorecardCompleted($state.streetCheck))}</td>
<td>{netDifference(results.overall)}</td>
<td>TODO</td>
<td>{improveOrReduce(results.overall, "the route quality")}</td>
{:else}
<th>Street Check</th>
<td>N/A</td>
Expand All @@ -114,7 +123,9 @@
</th>
<td>{yesNo(isScorecardCompleted($state.streetPlacemakingCheck))}</td>
<td>{netDifference(results.placemakingOverall)}</td>
<td>TODO</td>
<td>
{improveOrReduce(results.placemakingOverall, "the quality of place")}
</td>
{:else}
<th>Street Placemaking</th>
<td>N/A</td>
Expand All @@ -128,6 +139,7 @@
<th><a href="{base}/route_check/path_check">Path Check</a></th>
<td>{yesNo(isScorecardCompleted($state.pathCheck))}</td>
<td>{netDifference(results.overall)}</td>
<td>{improveOrReduce(results.overall, "the path quality")}</td>
<td>TODO</td>
{:else}
<th>Path Check</th>
Expand All @@ -144,7 +156,9 @@
</th>
<td>{yesNo(isScorecardCompleted($state.pathPlacemakingCheck))}</td>
<td>{netDifference(results.placemakingOverall)}</td>
<td>TODO</td>
<td>
{improveOrReduce(results.placemakingOverall, "the quality of place")}
</td>
{:else}
<th>Path Placemaking</th>
<td>N/A</td>
Expand Down

0 comments on commit ad9dbce

Please sign in to comment.