Uploaded image for project: 'PhenoTips'
  1. PT-3953

Gene deletion on the patient form may delete incorrect genes

    Details

    • Sprint:

      Description

      To reproduce:
      1) create a patient with 2 or more genes
      2) manually delete gene #2
      3a) without closing the edit tab, in a separate tab in view mode observe that gene #1 was deleted instead of gene #2
      3b) in the original "edit" tab click 'save and view summary". Both genes will be present


      The reason is that the code in geneVariantmacros.vm calls

      $doc.getObject($!{request.geneclassname}, $!{request.objnumber})
      

      which always gets the first object because (to be investigated if this is correct) request.objnumber always evaluates to a string, which gets evaluated to 0. The fix is to wrap request.objnumber with $mathtool.toInteger() as is done in some other places in the code.

      (it is to be investigated why it ever worked at all. Currently it works with no bugs on (old) playground.phenpotips.org, but is buggy on production PC)

      A test page can be created to see what works and what not:

      {{velocity}}
      #set($d=$xwiki.getDocument("data.P00000xx"))      # a patient with 2 genes
      $d.getObject("PhenoTips.GeneClass").getValue('gene')  # ID of gene #0
      xxxx
      $d.getObject("PhenoTips.GeneClass",0).getValue('gene')  # works, ID of gene #0
      $d.getObject("PhenoTips.GeneClass",1).getValue('gene')  # works, ID of gene #1
      xxxx
      $d.getObject("PhenoTips.GeneClass","0").getValue('gene')  # ID of gene #0
      $d.getObject("PhenoTips.GeneClass","1").getValue('gene')  # [!!] also ID of gene #0 <------------
      xxxx
      $d.getObject("PhenoTips.GeneClass",$mathtool.toInteger("0")).getValue('gene')  # works, ID of gene #0
      $d.getObject("PhenoTips.GeneClass",$mathtool.toInteger("1")).getValue('gene')  # works, ID of gene #1
      {{/velocity}}
      

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                asm Andrew Misyura
                Reporter:
                asm Andrew Misyura
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: