OpenClinica / enketo-express-oc

A fork of Enketo Smart Paper for OpenClinica
Apache License 2.0
5 stars 22 forks source link

Update complete forms Close action #306

Closed pbowen-oc closed 4 years ago

pbowen-oc commented 4 years ago

When a compete form is opened, it only shows a Close button (not a Complete button). This Close button is calling /fieldsubmission/complete/ when the user clicks it. Since the form is already complete when it is opened in this state, there is no further need to call this endpoint. We have recently found that this call is causing undesirable behavior for us, so we would like to simply not make this call for already Complete forms. (Note that the Complete button on not yet complete forms should still continue to make this call.)

I think these are the only form endpoints that currently have the behavior we want to change: POST /instance/edit/rfc POST /instance/edit/rfc/c POST /instance/headless/rfc

This will be included as part of a minor bug fix release, so we would like the change made on top of our current deployed version - 1.84.1.oc-1

MartijnR commented 4 years ago
pbowen-oc commented 4 years ago

The checks associated with the Close button are still different for incomplete forms and complete forms. Incomplete forms, for example, don't complain about missing required items on Close.

MartijnR commented 4 years ago

/edit/rfc with completed record

curl --user enketorules: -d "server_url=https://enketo-aggregate.appspot.com&form_id=vitals&instance=<demo-vitals-grid-v9 xmlns:oc=\"http://openclinica.org/xforms\" oc:complete=\"true\"><page1><temp_yn>1</temp_yn></page1></demo-vitals-grid-v9>&instance_id=someUUID&ecid=a&instance_attachments[test.jpg]=http://www.kobotoolbox.org/sites/toolbox/themes/Rise_sub/logo.png" http://localhost:8005/oc/api/v1/instance/edit/rfc
MartijnR commented 4 years ago

2 options:

  1. Don't call /fieldsubmission/complete if record already marked as complete (in any view)
  2. Don't call /fieldsubmission/complete in any rfc view (these views only work if record is marked as complete)

I think 1 is more robust, so I'm choosing that one.

pbowen-oc commented 4 years ago

Can you tag this as 1.84.1.oc-2? I'd like it to be just 1.84.1.oc-1 + this update.

MartijnR commented 4 years ago

This change was done on top of 1.85.0 (in Enketo Express - not custom to OC) so I created the 1.85.0.oc-1 tag.

pbowen-oc commented 4 years ago

Looks good!