Loris icon indicating copy to clipboard operation
Loris copied to clipboard

[survey] Fix for JSONdata and LINST instruments

Open ridz1208 opened this issue 3 years ago • 12 comments

Brief summary of changes

The survey instrument logic had fallen severely behind the latest standards. This PR adds support for LINST instrument pages, getSubtestList() which deprecated the instrument_subtests table in the database and JSON data saving and loading.

MAKE SURE TO REVIEW PR with "Hide whitespaces changes" as the indentation in files was fixed for readability

More details on changes:

  1. fixes numbering issues on pages in survey instruments (causing next/prev page to not function properly)
  2. fixes type hinting issues, more specifically on return values from getPrevPage() and getNextPage() functions
  3. fixes saving/loading functionality to support JSON data in survey forms
  4. cleans redundant page number variables and unused variables (ie. $totalpages)
  5. fixes #7667 (hopefully)

Testing instructions (if applicable)

  1. Follow survey testing plan
  2. make sure to test for at least 1 of each of the following usecases
    • PHP instrument using SQL table for saving
    • LINST instrument using SQL table
    • PHP instrument using JSON saving in flag table
    • LINST instrument using JSON saving in flag table
    • single page instrument
    • multipage instrument

Link(s) to related issue(s)

  • Resolves #7667

ridz1208 avatar Nov 09 '21 00:11 ridz1208

@driusan critical ?

ridz1208 avatar Nov 09 '21 12:11 ridz1208

@ridz1208 is going to split this up into multiple PRs. Parts of it (the NDB_BVL_Instrument part) are critical, parts of it (the survey part) can go into a bug fix release after being well tested, since the changes seem pretty significant.

driusan avatar Nov 09 '21 20:11 driusan

needs rebase after #7819 and #7820 are merged

ridz1208 avatar Nov 10 '21 21:11 ridz1208

blocked by #7818

ridz1208 avatar Nov 23 '21 21:11 ridz1208

@driusan I think this was deemed as not critical to release but it's still a valueable bugfix if we wanna assign it. It is rebased and ready to go

ridz1208 avatar Nov 25 '21 18:11 ridz1208

Hey @suzanne-lee given that you have the initial ticket for this. can you try out this fix ?

ridz1208 avatar Dec 13 '21 15:12 ridz1208

For BMI Calculator, the top left corner now says "Page 1 of 4" rather than "Page 1 of 1". However, the save & continue button is no longer appearing and therefore cannot be fully tested. See screenshot:

Screen Shot 2022-01-11 at 9 37 21 AM

suzanne-lee avatar Jan 11 '22 14:01 suzanne-lee

@suzanne-lee should be ready again

ridz1208 avatar Jan 12 '22 17:01 ridz1208

When you open the BMI calculator, there is an array being shown at the top. Additionally, the page number doesn't say "Page 1 of 4", it says "Page top of 4".

Screen Shot 2022-03-24 at 9 25 52 AM

After trying to submit the first page, the following error is shown:

Screen Shot 2022-03-24 at 9 26 48 AM

suzanne-lee avatar Mar 24 '22 13:03 suzanne-lee

@suzanne-lee I removed the print statement and fixed the page numbers shown.

As for your saving issue, I do not get that error when I test, here are a couple debugging steps you can take:

  1. make sure your bmi.linst and bmi.meta files are freshly copied from the raisinbread directory
  2. set the jsonData variable in bmi.meta to true and see if the pages save. (if they save then you might have an SQL issue in your bmi table)
  3. set the jsonData back to false and see if the issue you get is related to the SQL table you have for the bmi
  4. try other instruments that are non LINST

I tried all steps above and they all work on my VM. Also the error you reported seems to be linked to the getDataDictionary() function in the NDB_BVL_Instrument_LINST class. If all else fails, maybe you can try to print the return of that function and see why the Date_taken field is not in that array

ridz1208 avatar Mar 31 '22 16:03 ridz1208

Still trying to figure out the Date_taken problem, but the page numbering has been resolved.

suzanne-lee avatar Apr 04 '22 18:04 suzanne-lee

I am able to view and submit all of the pages, as well as submit the entire form. However, the "Choose unit of measurement" question doesn't save; the element's name is supposed to be unit_classification but is pageNum on the browser (see below).

Screen Shot 2022-04-05 at 10 08 28 AM

suzanne-lee avatar Apr 05 '22 14:04 suzanne-lee

@ridz1208 there are conflicts with the base branch. Also, should there be an entry in the CHANGELOG for this bug fix?

cmadjar avatar Sep 22 '22 18:09 cmadjar

@driusan conflicts resolved

ridz1208 avatar Sep 22 '22 19:09 ridz1208