diff --git a/app/routes/reading.js b/app/routes/reading.js index 4d53c37b..850e2425 100644 --- a/app/routes/reading.js +++ b/app/routes/reading.js @@ -285,6 +285,35 @@ module.exports = (router) => { res.redirect(`/reading/session/${req.params.sessionId}/your-reads`) }) + // Route for resuming a session — jumps straight into the next readable case, + // falling back to the session overview if none exists. + router.get('/reading/session/:sessionId/resume', (req, res) => { + const data = req.session.data + const { sessionId } = req.params + const session = getReadingSession(data, sessionId) + if (!session) { + return res.redirect('/reading') + } + + const sessionEvents = session.eventIds + .map((eventId) => data.events.find((e) => e.id === eventId)) + .filter(Boolean) + + const resumeEvent = getResumeEventForUser( + sessionEvents, + data.currentUser.id, + session.skippedEvents || [] + ) + + if (resumeEvent) { + return res.redirect( + `/reading/session/${sessionId}/events/${resumeEvent.id}` + ) + } + + res.redirect(`/reading/session/${sessionId}`) + }) + // Route for skipped-review page (shown at end of batch when skipped cases remain) router.get('/reading/session/:sessionId/skipped-review', (req, res) => { const data = req.session.data diff --git a/app/views/_templates/layout-base.html b/app/views/_templates/layout-base.html index 849d3d86..bc57ae2e 100644 --- a/app/views/_templates/layout-base.html +++ b/app/views/_templates/layout-base.html @@ -43,7 +43,7 @@ current: true if navActive == "screening" }, { - href: "/reading", + href: "/reading/index-simple", text: "Image reading", current: true if navActive == "reading" }, diff --git a/app/views/reading/index-complex.html b/app/views/reading/index-complex.html new file mode 100644 index 00000000..2ec79f03 --- /dev/null +++ b/app/views/reading/index-complex.html @@ -0,0 +1,187 @@ +{# app/views/events/image-reading/index.html #} + +{% extends 'layout-app.html' %} + +{% set pageHeading = "Image reading" %} +{% set hideBackLink = true %} +{% set gridColumn = "nhsuk-grid-column-full" %} +{% set showRemaining = data.settings.reading.showRemaining | falsify %} + +{% block pageContent %} +
+ {{ allReadCount }} cases needing reading +
+ + {% if hasPriortyTags %} +Choose what cases to read
+{{ actionLink({ + classes: "nhsuk-link--no-visited-state nhsuk-u-margin-top-2", + text: "Start custom session", + href: "/reading/create-custom-session" +}) }} +{% endset %} + +{# Arbitration card content #} +{% set arbitrationContent %} +53 cases need arbitration
+{{ actionLink({ + classes: "nhsuk-link--no-visited-state nhsuk-u-margin-top-2", + text: "See cases", + href: "#" +}) }} +{% endset %} + +{# Reading history card content #} +{% set readingHistoryContent %} +View your reading history and all recently read cases
+{{ actionLink({ + classes: "nhsuk-link--no-visited-state nhsuk-u-margin-top-2", + text: "View history", + href: "/reading/history" +}) }} +{% endset %} + +You have an image reading session in progress. Finish it before starting a new one.
+{{ inProgressSession.userReadCount }} of {{ inProgressSession.targetSize }} cases read.
+ + {{ button({ + text: "Resume session", + href: "/reading/session/" + inProgressSession.id + "/resume" + }) }} + + {% else %} + +Start a new image reading session with {{ defaultSessionSize }} cases.
+ + {{ button({ + text: "Start now", + href: "/reading/create-session?type=all_reads" + }) }} + + {% endif %} + + {% if actionTotal > 0 %} + {% set insetHtml %} +{{ actionTotal }} flagged {{ "case" if actionTotal == 1 else "cases" }}
+{{ backlogTotal }} cases require reading
+- {{ allReadCount }} cases needing reading -
+{# + Backlog counts — all eligible cases that still need reading, banded by + age relative to the configured priority/urgent thresholds. +#} +{% set backlogEvents = data.events + | filterEventsByEligibleForReading + | filterEventsByNeedsAnyRead %} +{% set backlogTotal = backlogEvents | length %} +{% set urgentBacklog = backlogEvents | filterEventsByDayRange(data.config.reading.urgentThreshold) | length %} +{% set priorityBacklog = backlogEvents | filterEventsByDayRange(data.config.reading.priorityThreshold, data.config.reading.urgentThreshold - 1) | length %} - {% if hasPriortyTags %} -{{ actionTotal }} {{ "case" if actionTotal == 1 else "cases" }} need action
+Choose what cases to read
-{{ actionLink({ - classes: "nhsuk-link--no-visited-state nhsuk-u-margin-top-2", - text: "Start custom session", - href: "/reading/create-custom-session" -}) }} -{% endset %} - -{# Arbitration card content #} -{% set arbitrationContent %} -53 cases need arbitration
-{{ actionLink({ - classes: "nhsuk-link--no-visited-state nhsuk-u-margin-top-2", - text: "See cases", - href: "#" -}) }} -{% endset %} - -{# Reading history card content #} -{% set readingHistoryContent %} -View your reading history and all recently read cases
-{{ actionLink({ - classes: "nhsuk-link--no-visited-state nhsuk-u-margin-top-2", - text: "View history", - href: "/reading/history" -}) }} -{% endset %} - -You have an image reading session in progress. Finish it before starting a new one.
+{{ inProgressSession.userReadCount }} of {{ inProgressSession.targetSize }} cases read.
-Start a new image reading session with {{ defaultSessionSize }} cases.
-{{ backlogTotal }} cases require reading
+