submission-model

Methods

(static) add(id, instanceId, deprecatedId)

Source:
Parameters:
Name Type Description
id string

Enketo ID of survey

instanceId string

instance ID of record

deprecatedId string

deprecated ID of record

(static) isNew(id, instanceId) → {Promise.<(Error|boolean)>}

Source:

Whether instanceID was submitted successfully before.

To prevent large submissions that were divided into multiple batches from recording multiple times, we use a redis capped list to store the latest 100 instanceIDs This list can be queried to avoid double-counting instanceIDs

Note that edited records are submitted multiple times with different instanceIDs.

Parameters:
Name Type Description
id string

Enketo ID of survey

instanceId string

instance ID of record

Returns:

a Promis that resolves with a boolean

Type
Promise.<(Error|boolean)>

(inner) _alreadyRecorded(instanceId, listopt) → {boolean}

Source:
Parameters:
Name Type Attributes Description
instanceId string

instance ID of record

list Array.<string> <optional>

List of IDs

Returns:

Whether instanceID already exists in the list

Type
boolean

(inner) _formatter(options, severity, date, elems)

Source:

Formatter function for logger

Parameters:
Name Type Description
options object

logger formatting options

severity object

level of log message

date object

date

elems Array.<object>

object to log

(inner) _getLatestSubmissionIds(key) → {Promise}

Source:
Parameters:
Name Type Description
key string

database key

Returns:

a Promise that resolves with a redis list of submission IDs

Type
Promise