Skip to content

Commit

Permalink
Fixing bug with routing on new sentence journey
Browse files Browse the repository at this point in the history
  • Loading branch information
ashley-wheat committed Feb 26, 2025
1 parent 20cb332 commit ccef9df
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 55 deletions.
4 changes: 4 additions & 0 deletions app/assets/sass/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,10 @@ body {
height: unset;
}

.moj-interruption-card__body > p {
font-size: unset !important;
}

// .filter > .govuk-details__text > .hods-expandable-banner[open] > .hods-expandable-banner__summary:focus {
// background: none;
// text-decoration: none;
Expand Down
17 changes: 13 additions & 4 deletions app/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2255,6 +2255,10 @@ router.get(

router.get("/:prototypeVersion/merged-cases-select", function (req, res) {
const prototypeVersion = req.params.prototypeVersion;
const route = req.session.data.route;
console.log("Route: " + route);
const warrantType = req.session.data.appearance["warrant-type"];
console.log("Warrant type: " + warrantType);
const mergedCases = req.session.data.appearance["merged-cases"];
console.log("Merged cases: " + mergedCases);
if (prototypeVersion < 22)
Expand All @@ -2269,7 +2273,7 @@ router.get("/:prototypeVersion/merged-cases-select", function (req, res) {
}
else if (prototypeVersion >= 22) {
if (mergedCases == "Yes") {
if (req.session.data.appearance["warrant-type"] == "Remand") {
if (warrantType == "Remand") {
res.redirect(
`/${prototypeVersion}/court-cases/add-an-offence/select-merged-cases`
);
Expand All @@ -2279,13 +2283,18 @@ router.get("/:prototypeVersion/merged-cases-select", function (req, res) {
);
}
} else {
if (req.session.data.appearance["warrant-type"] == "Remand") {
if (warrantType == "Remand") {
res.redirect(
`/${prototypeVersion}/court-cases/add-an-offence/offence-date`
);
} else {
} else if (warrantType == "Sentencing" && route == "appearance"){
res.redirect(
`/${prototypeVersion}/court-cases/add-a-sentence/check-answers-additional-information`
);
}
else {
res.redirect(
`/${prototypeVersion}/court-cases/add-a-sentence/count-number`
`/${prototypeVersion}/court-cases/add-a-sentence/check-answers-additional-information`
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1 class="govuk-fieldset__heading">
</legend>

<div id="file-upload-1-hint" class="govuk-hint">
Documents must be in a .PDF format and smaller than 500MB.
Uploading documents is optional. The selected file type should be .PDF under 500MB.
</div>

<p class="govuk-body" aria-live="polite">1 file uploaded</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% extends "../template.html" %}
{% block content %}
<!-- What is the confirmed date -->
<div class="govuk-grid-row govuk-!-margin-top-4">
<div class="govuk-grid-column-two-thirds">
<form class="form" action="/{{data.prototypeVersion}}/sentence-length-mismatch-select?route=remand-to-sentence"
Expand All @@ -9,18 +8,20 @@
<div class="moj-interruption-card">
<div class="moj-interruption-card__content">
<h1 class="govuk-heading-l moj-interruption-card__heading">Sentence length mismatch</h1>
<div class="govuk-body-l moj-interruption-card__body">
<p class="govuk-body">The sentence lengths you have entered total {{
<div class="govuk-body moj-interruption-card__body">
<p class="govuk-body">The sentence lengths you have entered total:</p>
<p class="govuk-body govuk-!-font-weight-bold">{{
data.appearance['total-sentence-length-years'] }} years {{ data.appearance['total-sentence-length-months'] }}
months {{ data.appearance['total-sentence-length-weeks'] }} weeks {{
data.appearance['total-sentence-length-days'] }} days. </p>
<p>This does not match the overall sentence length from the warrant, which is <br> {{
<p>This does not match the overall sentence length from the warrant, which is:
<p class="govuk-body govuk-!-font-weight-bold"> {{
data.appearance['overall-sentence-length-years'] }} years {{ data.appearance['overall-sentence-length-months']
}} months {{ data.appearance['overall-sentence-length-weeks'] }} weeks {{
data.appearance['overall-sentence-length-days'] }} days.</p>
<p class="govuk-body">You can go back and review offences, or you can continue with sentence length mismatch.</p>
<p class="govuk-body">If you continue, only a provisional calculation can be made.</p>
<p class="govuk-body govuk-!-font-weight-bold">Do you want to continue?</p>
<p class="govuk-body govuk-!-font-weight-bold govuk-!-margin-top-6">Do you want to continue?</p>
</div>
<div class="govuk-button-group moj-interruption-card__actions">
<button type="submit" class="govuk-button govuk-button--inverse" data-module="govuk-button">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1 class="govuk-fieldset__heading">
</legend>

<div id="file-upload-1-hint" class="govuk-hint">
Documents must be in a .PDF format and smaller than 500MB.
Uploading documents is optional. The selected file type should be .PDF under 500MB.
</div>

<p class="govuk-body" aria-live="polite">1 file uploaded</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,38 @@
{% extends "../template.html" %}
{% block content %}
<!-- What is the confirmed date -->
<div class="govuk-grid-row govuk-!-margin-top-4">
<div class="govuk-grid-column-two-thirds">
<form class="form" action="/{{data.prototypeVersion}}/sentence-length-mismatch-select" method="post">
<div class="govuk-form-group">
<h1 class="govuk-heading-l">
<span class="govuk-caption-l">Add offences</span>
Sentence length mismatch
</h1>
<p class="govuk-body">The sentence lengths you have entered total {{ data.appearance['total-sentence-length-years'] }} years {{ data.appearance['total-sentence-length-months'] }} months {{ data.appearance['total-sentence-length-weeks'] }} weeks {{ data.appearance['total-sentence-length-days'] }} days. </p>
<p>This does not match the overall sentence length from the warrant, which is <br>{{ data.appearance['overall-sentence-length-years'] }} years {{ data.appearance['overall-sentence-length-months'] }} months {{ data.appearance['overall-sentence-length-weeks'] }} weeks {{ data.appearance['overall-sentence-length-days'] }} days.</p>
<div class="govuk-form-group">
<fieldset class="govuk-fieldset govuk-!-margin-top-6">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--m">
<h1 class="govuk-fieldset__heading">
Do you want to continue?
</h1>
</legend>
<div class="govuk-radios" data-module="govuk-radios">
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="sentence-length-mismatch" name="appearance[sentence-length-mismatch]" type="radio" value="yes">
<label class="govuk-label govuk-radios__label" for="sentence-length-mismatch">
Yes, continue with mismatching sentence lengths
</label>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="sentence-length-mismatch-2" name="appearance[sentence-length-mismatch]" type="radio" value="no">
<label class="govuk-label govuk-radios__label" for="sentence-length-mismatch-2">
No, go back and review offences
</label>
</div>
</div>
</fieldset>
<div class="govuk-button-group govuk-!-margin-top-6"><button class="govuk-button">Continue</button></div>

</div>
<div class="govuk-grid-column-two-thirds">
<form class="form" action="/{{data.prototypeVersion}}/sentence-length-mismatch-select"
method="post">
<div class="govuk-form-group">
<div class="moj-interruption-card">
<div class="moj-interruption-card__content">
<h1 class="govuk-heading-l moj-interruption-card__heading">Sentence length mismatch</h1>
<div class="govuk-body moj-interruption-card__body">
<p class="govuk-body">The sentence lengths you have entered total:</p>
<p class="govuk-body govuk-!-font-weight-bold">{{
data.appearance['total-sentence-length-years'] }} years {{ data.appearance['total-sentence-length-months'] }}
months {{ data.appearance['total-sentence-length-weeks'] }} weeks {{
data.appearance['total-sentence-length-days'] }} days. </p>
<p>This does not match the overall sentence length from the warrant, which is:
<p class="govuk-body govuk-!-font-weight-bold"> {{
data.appearance['overall-sentence-length-years'] }} years {{ data.appearance['overall-sentence-length-months']
}} months {{ data.appearance['overall-sentence-length-weeks'] }} weeks {{
data.appearance['overall-sentence-length-days'] }} days.</p>
<p class="govuk-body">You can go back and review offences, or you can continue with sentence length mismatch.</p>
<p class="govuk-body">If you continue, only a provisional calculation can be made.</p>
<p class="govuk-body govuk-!-font-weight-bold govuk-!-margin-top-6">Do you want to continue?</p>
</div>
</form>
</div>
<div class="govuk-button-group moj-interruption-card__actions">
<button type="submit" class="govuk-button govuk-button--inverse" data-module="govuk-button">
Yes, continue
</button>
<a class="govuk-link govuk-link--inverse" href="add-sentence-information">Go back to update offence outcomes</a>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ <h1 class="govuk-heading-l">
Does this warrant include offences from other court cases?
</dt>
<dd class="govuk-summary-list__value">
{{ data['appearance']['merged-cases'] }}
{% if data['appearance']['merged-cases'] == "None" %}No{% else %}{{ data['appearance']['merged-cases'] }}{% endif %}
</dd>
<dd class="govuk-summary-list__actions">
<a class="govuk-link" href="merged-cases?edit=true">Edit<span class="govuk-visually-hidden">
Expand Down
9 changes: 3 additions & 6 deletions app/views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ <h3 class="govuk-heading-m">In this version</h3>
<h3 class="govuk-heading-m">Prototype links</h3>
<ul class="govuk-list">
<li><a href="/22/launch-prototype?version=22">Version 22</a><strong
class="govuk-tag govuk-tag--orange" style="vertical-align: middle; margin-left: 10px;">
Currently working on
class="govuk-tag govuk-tag--blue" style="vertical-align: middle; margin-left: 10px;">
Stable
</strong></li>
</ul>
<hr class="govuk-section-break govuk-section-break--xl govuk-section-break--visible">
Expand Down Expand Up @@ -72,10 +72,7 @@ <h3 class="govuk-heading-m">In this version</h3>
</ul>
<h3 class="govuk-heading-m">Prototype links</h3>
<ul class="govuk-list">
<li><a href="/20/launch-prototype?version=20">Version 20</a><strong
class="govuk-tag govuk-tag--blue" style="vertical-align: middle; margin-left: 10px;">
Stable
</strong></li>
<li><a href="/20/launch-prototype?version=20">Version 20</a></li>
</ul>
<hr class="govuk-section-break govuk-section-break--xl govuk-section-break--visible">
<!-- Version 19 -->
Expand Down

0 comments on commit ccef9df

Please sign in to comment.