Middleware for oragnisation (LPA) overview page
module:middleware-lpa-overview
Organisation (LPA) overview page middleware chain.
Members
(static, constant) addNoticesToDatasets
This middleware function adds notices to datasets based on the notice flags.
It modifies the req.datasets
and req.notices
properties.
(static, constant) datasetSubmissionDeadlineCheck
This middleware function checks if a dataset has been submitted within a certain timeframe and sets flags for due and overdue notices accordingly.
(inner, constant) fetchDatasetErrorStatus
Middleware. Updates req with 'datasetErrorStatus'.
Fetches datasets which have active endpoints in error state.
Methods
(static) prepareDatasetObjects(req, res, next)
Updates req.datasets objects with endpoint status and error information.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
req |
Object |
Properties
|
|||||||||||||||||||||||||||||||||
res |
* | ||||||||||||||||||||||||||||||||||
next |
* |
(static) prepareOverviewTemplateParams(req, res, next) → {void}
Prepares overview template parameters.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
req |
Object | Express request object Properties
|
||||||||||||||||||||||||||||||||||||
res |
Object | Express response object |
||||||||||||||||||||||||||||||||||||
next |
function | Express next function |
Returns:
- Type
- void
(inner) orgStatsReducer(accumulator, dataset) → {Array.<number>}
Calculates overall "health" of the datasets (not)provided by an organisation.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
accumulator |
Array.<number> | Array containing counts [withEndpoints, needsFixing, hasErrors] |
||||||||||||||||||||||||
dataset |
Object | Dataset information Properties
|
Returns:
Updated accumulator
- Type
- Array.<number>