We're updating the issue view to help you get more done. 

Gene deletion on the patient form may delete incorrect genes

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

1 $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:

1 2 3 4 5 6 7 8 9 10 11 12 13 {{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}}

Environment

None

Status

Assignee

Andrew Misyura

Reporter

Andrew Misyura

Labels

None

External issue ID

None

External issue ID

None

Components

Fix versions

Affects versions

1.4.3
1.3.9

Priority

Major