Skip to content

Commit 63cf321

Browse files
Fix regional interface (#557)
1 parent e55261f commit 63cf321

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

app/data/session-data-defaults.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ module.exports = {
1515
nhsNumberKnown: "yes",
1616
currentUserId: "2387441662601",
1717
currentOrganisationId: "RW3",
18-
currentRegionId: "Y62",
1918
vaccinationsRecorded: [],
2019

2120
// These are the options for extracting CSV reports

app/routes/regions.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ module.exports = router => {
33
router.get('/regions', (req, res) => {
44
const data = req.session.data
55

6-
const currentRegion = res.locals.currentOrganisation
6+
const currentOrganisation = res.locals.currentOrganisation
77

8-
const organisations = data.organisations.filter((organisation) => (organisation.region === currentRegion.id) && (["Active", "Invited", "Deactivated"].includes(organisation.status)))
8+
const organisations = data.organisations.filter((organisation) => (organisation.region === currentOrganisation.id) && (["Active", "Invited", "Deactivated"].includes(organisation.status)))
99

10-
const closedOrganisationsCount = data.organisations.filter((organisation) => (organisation.region === currentRegion.id && organisation.status == "Closed")).length
10+
const closedOrganisationsCount = data.organisations.filter((organisation) => (organisation.region === currentOrganisation.id && organisation.status == "Closed")).length
1111

1212
res.render('regions/index', {
1313
organisations,
@@ -16,10 +16,10 @@ module.exports = router => {
1616
})
1717

1818
router.get('/regions/organisations/closed', (req, res) => {
19-
const currentRegion = res.locals.currentOrganisation
19+
const currentOrganisation = res.locals.currentOrganisation
2020

2121
const data = req.session.data
22-
const organisations = data.organisations.filter((organisation) => (organisation.region === currentRegion.id && organisation.status == "Closed"))
22+
const organisations = data.organisations.filter((organisation) => (organisation.region === currentOrganisation.id && organisation.status == "Closed"))
2323

2424
res.render('regions/closed-organisations', {
2525
organisations
@@ -47,7 +47,7 @@ module.exports = router => {
4747
// Inviting an organisation
4848
router.post('/regions/add', (req, res) => {
4949
const data = req.session.data
50-
const currentRegion = res.locals.currentOrganisation
50+
const currentOrganisation = res.locals.currentOrganisation
5151

5252
const organisationId = data.organisationId
5353
const organisation = data.allOrganisations.find((org) => org.id === organisationId)
@@ -61,7 +61,7 @@ module.exports = router => {
6161
address: organisation.address,
6262
type: organisation.type,
6363
status: 'Invited',
64-
region: currentRegion.id
64+
region: currentOrganisation.id
6565
})
6666

6767
req.session.data.users.push({
@@ -163,7 +163,7 @@ module.exports = router => {
163163
const vaccines = organisation.vaccines || []
164164
const vaccinesEnabled = vaccines.filter((vaccine) => vaccine.status === "enabled")
165165

166-
const messages = res.locals.currentOrganisation.inbox.filter((message) => message.fromOrganisationId === id)
166+
const messages = (res.locals.currentOrganisation.inbox || []).filter((message) => message.fromOrganisationId === id)
167167

168168
res.render('regions/organisation', {
169169
organisation,

app/views/regions/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% extends 'layout.html' %}
22

3-
{% set pageName = currentRegion.name %}
3+
{% set pageName = currentOrganisation.name %}
44
{% set currentSection = "organisations" %}
55

66
{% block content %}

0 commit comments

Comments
 (0)