diff --git a/modules/api/php/endpoints/candidate/visit/instrument/instrument.class.inc b/modules/api/php/endpoints/candidate/visit/instrument/instrument.class.inc index a05483d5cb3..7d0b6e5452f 100644 --- a/modules/api/php/endpoints/candidate/visit/instrument/instrument.class.inc +++ b/modules/api/php/endpoints/candidate/visit/instrument/instrument.class.inc @@ -171,7 +171,9 @@ class Instrument extends Endpoint implements \LORIS\Middleware\ETagCalculator try { $instrumentname = $this->_instrument->testName; $this->_instrument->clearInstrument(); - $this->_instrument->_save($data[$instrumentname]); + $this->_instrument->_saveValues($data[$instrumentname]); + $this->_instrument->score(); + $this->_instrument->updateDataEntryCompletionStatus(); } catch (\Throwable $e) { error_log($e->getMessage()); return new \LORIS\Http\Response\JSON\InternalServerError(); @@ -208,7 +210,9 @@ class Instrument extends Endpoint implements \LORIS\Middleware\ETagCalculator try { $instrumentname = $this->_instrument->testName; - $this->_instrument->_save($data[$instrumentname]); + $this->_instrument->_saveValues($data[$instrumentname]); + $this->_instrument->score(); + $this->_instrument->updateDataEntryCompletionStatus(); } catch (\Throwable $e) { error_log($e->getMessage()); return new \LORIS\Http\Response\JSON\InternalServerError(); diff --git a/php/libraries/NDB_BVL_Instrument.class.inc b/php/libraries/NDB_BVL_Instrument.class.inc index 29ce500b78d..75a78d89449 100644 --- a/php/libraries/NDB_BVL_Instrument.class.inc +++ b/php/libraries/NDB_BVL_Instrument.class.inc @@ -585,14 +585,7 @@ abstract class NDB_BVL_Instrument extends NDB_Page if ($this->form->validate()) { $this->form->process(array(&$this, '_saveValues'), true); $this->score(); - - // determine the data entry completion status, and store that in - // the database - $dataEntryCompletionStatus - = $this->_determineDataEntryCompletionStatus(); - $this->_setDataEntryCompletionStatus( - $dataEntryCompletionStatus - ); + $this->updateDataEntryCompletionStatus(); } else { $submittedData = $this->form->getSubmitValues(); @@ -631,6 +624,23 @@ abstract class NDB_BVL_Instrument extends NDB_Page return true; } + /** + * This checks the current status of and instrument's data entry and updates + * it accordingly in the database + * + * @return void + */ + public function updateDataEntryCompletionStatus(): void + { + // determine the data entry completion status, and store that in + // the database + $dataEntryCompletionStatus + = $this->_determineDataEntryCompletionStatus(); + $this->setDataEntryCompletionStatus( + $dataEntryCompletionStatus + ); + } + /** * This handles the saving of the Candidate_Age and Window_Difference columns * to the database when the save function is called with a Date_taken.