Skip to content

Commit 34e9439

Browse files
Refactor PatientSession
1 parent 9421335 commit 34e9439

8 files changed

Lines changed: 191 additions & 177 deletions

File tree

app/models/patient-session.js

Lines changed: 183 additions & 169 deletions
Large diffs are not rendered by default.

app/models/session.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export class Session {
252252
/**
253253
* Get consent window
254254
*
255-
* @returns {object} Consent window
255+
* @returns {string} Consent window
256256
*/
257257
get consentWindow() {
258258
return getConsentWindow(this)

app/utils/reply.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function getRepliesWithHealthAnswers(replies) {
5858
* Get combined answers to health questions
5959
*
6060
* @param {import('../models.js').PatientSession} patientSession - Patient session
61-
* @returns {object|boolean} Combined answers to health questions
61+
* @returns {object|undefined} Combined answers to health questions
6262
*/
6363
export function getConsentHealthAnswers(patientSession) {
6464
const consentHealthAnswers = {}
@@ -69,7 +69,7 @@ export function getConsentHealthAnswers(patientSession) {
6969
).filter((reply) => reply.healthAnswers)
7070

7171
if (responsesWithHealthAnswers.length === 0) {
72-
return false
72+
return
7373
}
7474

7575
for (const response of responsesWithHealthAnswers) {

app/utils/session.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { today } from './date.js'
1616
* Get consent window (is it open, opening or closed)
1717
*
1818
* @param {import('../models.js').Session} session - Session
19-
* @returns {object} Consent window key and value
19+
* @returns {string} Consent window key and value
2020
*/
2121
export const getConsentWindow = (session) => {
2222
const nowAt = today()

app/views/patient-session/_consent.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}) %}
99
{# Description #}
1010
{% if not isVaccinated %}
11-
{{ patientSession.consentNotes | nhsukMarkdown }}
11+
{{ patientSession.consentDescription | nhsukMarkdown }}
1212

1313
{% if patientSession.patient.lastReminderDate %}
1414
{{ patientSession.patient.formatted.lastReminderDate | nhsukMarkdown }}

app/views/patient-session/_register.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
headingSize: "m"
44
}) %}
55
{# Description #}
6-
{{ patientSession.registerNotes | nhsukMarkdown }}
6+
{{ patientSession.registerDescription | nhsukMarkdown }}
77

88
{# Actions #}
99
{% if patientSession.register == RegistrationOutcome.Pending %}

app/views/patient-session/_report.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
headingSize: "m"
77
}) %}
88
{# Description #}
9-
{{ patientSession.reportNotes | nhsukMarkdown }}
9+
{{ patientSession.reportDescription | nhsukMarkdown }}
1010

1111
{# Decision table #}
1212
{% set vaccinationRows = [] %}

app/views/patient-session/_triage.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
headingSize: "m"
66
}) %}
77
{# Description #}
8-
{{ patientSession.screenNotes | nhsukMarkdown }}
8+
{{ patientSession.screenDescription | nhsukMarkdown }}
99

1010
{# Actions #}
1111
{{ actionLink({

0 commit comments

Comments
 (0)