Skip to content

Commit

Permalink
WB-1621 fix bug where project incremental ID was not being added unti…
Browse files Browse the repository at this point in the history
…l reload of iaResults.jsp... by forcing reload of iaResults.jsp. Improve messaging to end user
  • Loading branch information
Atticus29 committed Nov 23, 2021
1 parent 920d252 commit 1f3bbf5
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/main/webapp/iaResults.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,11 @@ if (request.getParameter("encId")!=null && request.getParameter("noMatch")!=null
}
MarkedIndividual mark = enc.getIndividual();
if (mark==null) {
mark = new MarkedIndividual(enc);
myShepherd.getPM().makePersistent(mark);
myShepherd.updateDBTransaction();
IndividualAddEncounter.executeEmails(myShepherd, request,mark,true, enc, context, langCode);
}
if (validToName&&"true".equals(useNextProjectId)) {
Expand All @@ -501,7 +499,6 @@ if (request.getParameter("encId")!=null && request.getParameter("noMatch")!=null
// old user based id
mark.addName(nextNameKey, nextName);
}
System.out.println("RTN for no match naming: "+rtn.toString());
rtn.put("success",true);
Expand Down Expand Up @@ -2072,12 +2069,12 @@ function negativeButtonClick(encId, oldDisplayName) {
var confirmMsg = 'Confirm no match?\n\n';
confirmMsg += 'By clicking \'OK\', you are confirming that there is no correct match in the results below. ';
if (oldDisplayName&&oldDisplayName!=""&&oldDisplayName.length) {
confirmMsg+= 'The name <%=nextNameString%> will be added to individual '+oldDisplayName;
if (oldDisplayName!=="undefined" && oldDisplayName && oldDisplayName !== "" && oldDisplayName.length) {
confirmMsg+= 'The name <%=nextName%> will be added to individual '+oldDisplayName + '.';
} else {
confirmMsg+= 'A new individual will be created with name <%=nextNameString%> and applied to encounter '+encDisplayString(encId);
confirmMsg+= 'A new individual will be created with name <%=nextName%> and applied to encounter '+encDisplayString(encId) +'.';
}
confirmMsg+= ' to record your decision.';
confirmMsg+= 'Click \'OK\' to record your decision.';
let paramStr = 'encId='+encId+'&noMatch=true';
let projectId = '<%=projectIdPrefix%>';
Expand All @@ -2094,15 +2091,25 @@ function negativeButtonClick(encId, oldDisplayName) {
dataType: 'json',
complete: function(d) {
console.log("RTN from negativeButtonClick : "+JSON.stringify(d));
updateNameCallback(d, oldDisplayName);
updateNameCallback(d, oldDisplayName, encId);
}
})
}
}
function updateNameCallback(d, oldDisplayName) {
function updateNameCallback(d, oldDisplayName, encId) {
console.log("Update name callback! got d="+d+" and stringify = "+JSON.stringify(d));
alert("Success! Added name <%=nextNameKey%>: <%=nextName%> to "+oldDisplayName);
let alertMsg = "Something went wrong with assigning the new name to the individual containing encounter " + encDisplayString(encId);
if(d && d.responseJSON && d.responseJSON.success){
if(oldDisplayName!=="undefined" && oldDisplayName){
alertMsg = "Success! Added name <%=nextNameKey%>: <%=nextName%> to "+oldDisplayName;
} else{
alertMsg = "Success! Added name <%=nextNameKey%>: <%=nextName%> to the new individual.";
}
}
alert(alertMsg);
location.reload(); // there was an issue where the new individual name was not appearing until the iaResults pages was reloaded. I don't know why, but this solves the problem.
}
function addNegativeButton(encId, oldDisplayName) {
Expand Down

0 comments on commit 1f3bbf5

Please sign in to comment.