Skip to content

Commit

Permalink
Merge pull request #1695 from uwcirg/present-needed-args
Browse files Browse the repository at this point in the history
Bug fix for TN-485
  • Loading branch information
pbugni authored Dec 7, 2017
2 parents 233673e + a042320 commit b4d02d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 29 deletions.
30 changes: 5 additions & 25 deletions portal/templates/profile_macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -1849,11 +1849,7 @@ <h4 class="modal-title">{{ _("Enter questionnaire manually on patient's behalf")
};
$(document).ready(function() {

var continueToAssessment = function(method, completionDate, linkUrl) {
/*
* note the linkUrl is present will override the existing asssessment link
*/
var assessment_url = linkUrl || {%if person.assessment_link%}"{{person.assessment_link|safe}}"{%else%}""{%endif%};
var continueToAssessment = function(method, completionDate, assessment_url) {
if (hasValue(assessment_url)) {
var still_needed = false;

Expand Down Expand Up @@ -1886,7 +1882,7 @@ <h4 class="modal-title">{{ _("Enter questionnaire manually on patient's behalf")
}, 2000);

setTimeout(function() { window.location = winLocation;}, 100);

} else {
$("#manualEntryMessageContainer").html("{%trans%}The user does not have a valid assessment link.{%endtrans%}");
};
Expand Down Expand Up @@ -2050,9 +2046,11 @@ <h4 class="modal-title">{{ _("Enter questionnaire manually on patient's behalf")

var method = $("input[name='entryMethod']:checked").val();
var completionDate = $("#qCompletionDate").val();
var linkUrl = "{{url_for('assessment_engine_api.present_needed', subject_id=person.id)}}";

if (method != "") {
$("#manualEntryMessageContainer").text("");

if (method === "paper") {

/*
Expand Down Expand Up @@ -2081,31 +2079,13 @@ <h4 class="modal-title">{{ _("Enter questionnaire manually on patient's behalf")
};

if (!hasValue(errorMsg)) {

/*
* retrieve instrument ids from present questionnaire bank
* only if the date is backdated, i.e. before today's date
*/
var d = $("#qCompletionDay").val();
var m = $("#qCompletionMonth").val();
var y = $("#qCompletionYear").val();
var todayObj = tnthDates.getTodayDateObj();
var td = todayObj.displayDay, tm = todayObj.displayMonth, ty = todayObj.displayYear;
var linkUrl = "";

if (td+tm+ty != (pad(d)+pad(m)+pad(y))) {
/*
* note the API will redirect to AE with the necessary instruments information
*/
linkUrl = "{{url_for('assessment_engine_api.present_needed')}}" + "?subject_id={{person.id}}";
};
continueToAssessment(method, completionDate, linkUrl);
};

};
});
} else {
continueToAssessment(method);
continueToAssessment(method, completionDate, linkUrl);
};
} else {
$("#manualEntryMessageContainer").html("{%trans%}You must select a method.{%endtrans%}");
Expand Down
4 changes: 0 additions & 4 deletions portal/views/patients.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ def patient_profile(patient_id):
if (display.access and display.link_url is not None and
display.link_label is not None):
user_interventions.append({"name": intervention.name})
if intervention.name == 'assessment_engine':
# Need to extend with subject_id as the staff user is driving
patient.assessment_link = '{url}&subject_id={id}'.format(
url=display.link_url, id=patient.id)

return render_template(
'profile.html', user=patient,
Expand Down

0 comments on commit b4d02d8

Please sign in to comment.