Skip to content

Commit

Permalink
Fixing bugs in remand to sentence journey
Browse files Browse the repository at this point in the history
  • Loading branch information
ashley-wheat committed Mar 4, 2025
1 parent a9c5acb commit d284d53
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
27 changes: 17 additions & 10 deletions app/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,6 @@ router.post("/:prototypeVersion/persist-appearance", function (req, res) {
`/${prototypeVersion}/court-cases/add-a-court-case/confirmation`
);
} else if (route == "appearance") {
if (prototypeVersion == "v12" || prototypeVersion >= 13) {
appearanceDetailsComplete = 1;
req.session.data.appearanceDetailsComplete = appearanceDetailsComplete;
console.log("Appearance details complete: " + appearanceDetailsComplete);
Expand All @@ -801,12 +800,15 @@ router.post("/:prototypeVersion/persist-appearance", function (req, res) {
"Appearance status: " + req.session.data.appearance["status"]
);
return res.redirect(`/${prototypeVersion}/court-cases/`);
} else if (req.query.appearanceComplete == 'true') {
return res.redirect(
`/${prototypeVersion}/court-cases/add-a-court-appearance/confirmation`
);
} else {
return res.redirect(
`/${prototypeVersion}/court-cases/add-a-court-appearance/task-list`
);
}
}
res.redirect(
`/${prototypeVersion}/court-cases/add-a-court-appearance/add-sentence-information`
);
Expand Down Expand Up @@ -1282,9 +1284,17 @@ router.post("/:prototypeVersion/persist-sentence", function (req, res) {
}

req.session.data.sentenceAdded = 1;
return res.redirect(
`/${prototypeVersion}/court-cases/add-a-sentence/check-answers`
);

if (route == "remand-to-sentence"){
console.log("Redirecting to add sentence information")
return res.redirect(
`/${prototypeVersion}/court-cases/add-a-court-appearance/add-sentence-information`
);
} else {
return res.redirect(
`/${prototypeVersion}/court-cases/add-a-sentence/check-answers`
);
}
});

router.get("/:prototypeVersion/view-court-case-detail", function (req, res) {
Expand Down Expand Up @@ -1614,13 +1624,10 @@ router.post("/:prototypeVersion/add-sentence-information", function (req, res) {
) {
req.session.data.sentence = req.session.data.appearance.offences[index];
}
req.session.data.changeMade = 0;
req.session.data.offenceDeleted = 0;
req.session.data.offenceAdded = 0;
if (route == "remand-to-sentence") {
req.session.data.sentence["outcome-changed"] = "true";
req.session.data.sentence = {...req.session.data.sentence, 'outcome-changed': "true"}
console.log(
"Ouctome changed: " + req.session.data.sentence["outcome-changed"]
"Outcome changed: " + req.session.data.sentence["outcome-changed"]
);
}
if (outcome == "Imprisonment") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h1 class="govuk-fieldset__heading">
</div>
<div class="govuk-radios__conditional govuk-radios__conditional--hidden" id="conditional-tagged-bail">
<div class="govuk-form-group">
<label class="govuk-label" for="appearance[tagged-bail]">
<label class="govuk-label govuk-!-font-weight-bold" for="tagged-bail-days">
Number of days
</label>
<input class="govuk-input govuk-input--width-3" id="tagged-bail-days" name="appearance[tagged-bail]" type="number" {% if data.appearance['tagged-bail'] %}{% if data.appearance['tagged-bail'].includes('Yes') %}value="{{ data.appearance['tagged-bail'] | last }}" {% endif %}{% endif %}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% block content %}
<div class="govuk-grid-row govuk-!-margin-top-4">
<div class="govuk-grid-column-two-thirds">
<form class="form" action="/{{data.prototypeVersion}}/persist-appearance" method="post">
<form class="form" action="/{{data.prototypeVersion}}/persist-appearance?appearanceComplete=true" method="post">
<div class="govuk-form-group">
<h1 class="govuk-heading-l">
Add a court appearance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ <h1 class="govuk-fieldset__heading">
</div>
<div class="govuk-radios__conditional govuk-radios__conditional--hidden"
id="conditional-overall-conviction-date-apply-all">
<p class="govuk-body govuk-!-font-weight-bold">Enter the conviction date</p>
<label class="govuk-label govuk-!-font-weight-bold" for="contact-by-email">
Enter the conviction date
</label>
<div class="govuk-date-input__item">
<div class="govuk-form-group">
<label class="govuk-label govuk-date-input__label"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ <h1 class="govuk-fieldset__heading">
<div class="govuk-radios__conditional govuk-radios__conditional--hidden"
id="conditional-overall-sentence-length">
<div class="govuk-form-group">
<h1 class="govuk-heading-s">
<label class="govuk-label govuk-!-font-weight-bold" for="contact-by-email">
Enter the overall sentence length
</h1>
</label>
<div class="govuk-date-input" id="overall-sentence-length-years">
<div class="govuk-date-input__item">
<div class="govuk-form-group">
Expand Down

0 comments on commit d284d53

Please sign in to comment.