@ -254,8 +254,7 @@ Fields:
|
||||
- `clients[].completedQuestionnaires`: array of questionnaires already completed by this client. Empty array if none.
|
||||
- `clients[].completedQuestionnaires[].questionnaireID`: the questionnaire ID, matching the IDs from the questionnaire list endpoint.
|
||||
- `clients[].completedQuestionnaires[].sumPoints`: total points from the last upload for this questionnaire.
|
||||
- `clients[].completedQuestionnaires[].completedAt`: when the questionnaire was completed on the device (milliseconds), or `null`.
|
||||
- `clients[].completedQuestionnaires[].uploadedAt`: when the latest version was received on the server (milliseconds), or `null`.
|
||||
- `clients[].completedQuestionnaires[].completedAt`: Unix timestamp (seconds) of when the questionnaire was completed, or `null` if not recorded.
|
||||
|
||||
Common failures:
|
||||
|
||||
@ -369,16 +368,14 @@ Answer fields:
|
||||
- `numericValue`: for numeric/range answers.
|
||||
- `answeredAt`: timestamp for this answer.
|
||||
|
||||
Upload behavior:
|
||||
Current upload behavior:
|
||||
|
||||
- Unknown or empty `questionID` values are skipped.
|
||||
- Unknown `answerOptionKey` values are stored as no selected option for that question.
|
||||
- Each successful POST **appends** an immutable `questionnaire_submission` record (version increments per client + questionnaire).
|
||||
- The latest answers are also written to the `client_answer` cache used by web results/CSV (always shows newest only).
|
||||
- `uploadedAt` is set by the server at POST time (milliseconds); do not send it from the client.
|
||||
- `completedAt` in the request is the device completion time; it is stored separately from `uploadedAt`.
|
||||
- Re-uploading the same `clientCode` and `questionID` overwrites the previous answer.
|
||||
- Re-uploading the same `clientCode` and `questionnaireID` overwrites the completed questionnaire status and point sum.
|
||||
- `sumPoints` is calculated from recognized `answerOptionKey` values.
|
||||
- Coaches may re-open, edit, and POST again; each upload creates a new submission version.
|
||||
- The current database stores one selected answer option per question. If the Android UI allows multiple selections for a layout, coordinate a server change before uploading multiple option keys for one question.
|
||||
|
||||
Success:
|
||||
|
||||
@ -387,20 +384,11 @@ Success:
|
||||
"ok": true,
|
||||
"data": {
|
||||
"submitted": true,
|
||||
"sumPoints": 0,
|
||||
"submissionID": "sub_…",
|
||||
"uploadedAt": 1714471800123,
|
||||
"submissionVersion": 2
|
||||
"sumPoints": 0
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Fetch Latest Answers (re-edit)
|
||||
|
||||
`GET /api/app_questionnaires?clientCode={code}&questionnaireID={id}&answers=1`
|
||||
|
||||
Returns the **latest** cached answers for a client/questionnaire in the same shape as POST `answers[]`. Use before reopening a completed questionnaire on the tablet.
|
||||
|
||||
Common failures:
|
||||
|
||||
- `400 INVALID_BODY`: request body is not valid JSON.
|
||||
|
||||
Reference in New Issue
Block a user