From caca8352be8beb931fe4246dc91d4582b15a7455 Mon Sep 17 00:00:00 2001 From: Boniface M Date: Fri, 29 Jul 2022 18:07:45 +0300 Subject: [PATCH 1/4] Breakpoint --- cpovc_forms/views.py | 6 +++--- static/js/cpara-validate-benchmark.js | 4 +++- templates/forms/new_cpara.html | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cpovc_forms/views.py b/cpovc_forms/views.py index c5baef29c..68a34fe00 100644 --- a/cpovc_forms/views.py +++ b/cpovc_forms/views.py @@ -10733,7 +10733,7 @@ def new_cpara(request, id): ind_answer = True else: ind_answer = False - breakpoint() + # breakpoint() try: OVCCareIndividaulCpara.objects.create( @@ -10755,8 +10755,8 @@ def new_cpara(request, id): print(error_message) else: - for h_mmembers in hhmembers: - hh_members = [] + hh_members = [] + for h_mmembers in hhmembers: hh_person_ids = h_mmembers.person.id hh_members.append(hh_person_ids) hh_members.append(id) diff --git a/static/js/cpara-validate-benchmark.js b/static/js/cpara-validate-benchmark.js index ef970c5b7..3fa835359 100644 --- a/static/js/cpara-validate-benchmark.js +++ b/static/js/cpara-validate-benchmark.js @@ -227,7 +227,7 @@ validBench(['CP1q', 'CP2q', 'CP3q', 'CP4q', 'CP5q'], ['AYES','AYES,ANA','AYES,AN validBench(['CP6q','CP7q','CP8q','CP9q','CP10q','CP11q','CP12q','CP13q','CP14q'], ['AYES','AYES,ANA','AYES','AYES','AYES,ANA','AYES','AYES','AYES,ANA','AYES'], 'CP2b'); // Healthy Goal 3 >> Benchmark 3 -// validBench(['CP23q_b_1','CP23q_b_2','CP23q_b_3'],['AYES','AYES','AYES'],'CP3b') +validBench(['CP23q_b_1','CP23q_b_2','CP23q_b_3'],['AYES','AYES','AYES'],'CP3b') // Healthy Goal 4 >> Benchmark 4 // $('input[name=CP41Skip').change(function (e){ // if ($('input[name=CP41Skip]:checked').val()==='ANA'){ @@ -251,6 +251,8 @@ validBench(['CP33q','CP34q','CP35q','CP36q'],['AYES','AYES','AYES','AYES,ANA'],' validBench(['CP330q','CP340q','CP350q','CP360q'],['AYES','AYES','AYES','AYES'],'CP90b') + + validDate('CP2d','CP1d','AYES','ANNO'); diff --git a/templates/forms/new_cpara.html b/templates/forms/new_cpara.html index 628e43512..fe9aaad9a 100644 --- a/templates/forms/new_cpara.html +++ b/templates/forms/new_cpara.html @@ -915,7 +915,7 @@

{% endif %} {% if hhmembers %} {% for sibling in hhmembers %} - {% if sibling.person.years >= 10 and sibling.person.years <= 20 %} + {% if sibling.person.years >= 12 and sibling.person.years <= 20 %} {{ sibling.person.first_name }} {{ sibling.person.surname }} {{ sibling.person.last_name }} @@ -951,6 +951,7 @@

+ {% endif %} {% endfor %} From d439bac8f74bbd6a5faa69dd73d356767c335f98 Mon Sep 17 00:00:00 2001 From: Boniface M Date: Tue, 2 Aug 2022 16:12:01 +0300 Subject: [PATCH 2/4] HRS var declared in if --- cpovc_forms/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpovc_forms/views.py b/cpovc_forms/views.py index 68a34fe00..310e1b79d 100644 --- a/cpovc_forms/views.py +++ b/cpovc_forms/views.py @@ -9856,6 +9856,7 @@ def new_hivscreeningtool(request, id): hiv_screen = None hiv_facility = None if request.method == 'POST': + try: form = HIV_SCREENING_FORM(request.POST, initial={'person': id}) @@ -9979,7 +9980,7 @@ def new_hivscreeningtool(request, id): data_to_save[skip] = False print(data_to_save) - # breakpoint() + ovcscreeningtool = OVCHIVRiskScreening.objects.create( person = RegPerson.objects.get(pk=int(id)), test_done_when = data_to_save.get('HIV_RS_03'), From 72dff6ee3581be556a8e5ad078909395b7e66552 Mon Sep 17 00:00:00 2001 From: Boniface M Date: Tue, 2 Aug 2022 20:23:30 +0300 Subject: [PATCH 3/4] Benchmark monitoring & HHRCPA calculation of graduation and control of workflow --- cpovc_forms/views.py | 7 +- templates/forms/edit_grad_monitor_tool.html | 61 +++++++++++++- templates/forms/new_grad_monitor_tool.html | 90 ++++++++++++++++++--- 3 files changed, 140 insertions(+), 18 deletions(-) diff --git a/cpovc_forms/views.py b/cpovc_forms/views.py index 310e1b79d..b368188fb 100644 --- a/cpovc_forms/views.py +++ b/cpovc_forms/views.py @@ -11394,14 +11394,14 @@ def delete_cpara(request, id, btn_event_pk): def grad_monitor_tool(request, id): if request.method == 'POST': data = request.POST - # print(data) + print(data) child = RegPerson.objects.get(id=id) house_hold = OVCHouseHold.objects.get(id=OVCHHMembers.objects.get(person=child).house_hold_id) caregiver_id = OVCRegistration.objects.get(person=child).caretaker_id caregiver = RegPerson.objects.get(id=caregiver_id) - event_date = convert_date(data.get('gm1d')) + event_date = data.get('gm1d') event_type_id = 'obm' time_saved = timezone.now() @@ -11424,7 +11424,8 @@ def grad_monitor_tool(request, id): answer_value = { 'AYES': True, - 'ANNO': False + 'ANNO': False, + None: False } try: OVCBenchmarkMonitoring.objects.create( diff --git a/templates/forms/edit_grad_monitor_tool.html b/templates/forms/edit_grad_monitor_tool.html index 2bfa37c6a..975bae9e3 100644 --- a/templates/forms/edit_grad_monitor_tool.html +++ b/templates/forms/edit_grad_monitor_tool.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} + {% extends 'base.html' %} {% load app_filters %} {% load static %} {% block page_title %} Graduation Monitoring Tool {% endblock %} @@ -213,7 +213,7 @@

Schooled

- + Cancel
@@ -248,6 +248,63 @@

Schooled

$('html,body').scrollTop(0); FormWizardValidation.init(); $('#monitoring_date').datepicker({ format: 'yyyy-mm-dd' }).val(); + $('input[name=cm13q]').prop("disabled", true); + $('input[name=cm14q]').prop("disabled", true); + + }); + +function submitActivate(){ + $('input[name=cm13q]').removeAttr('disabled') + $('input[name=cm14q]').removeAttr('disabled') +} + +$('input[name=form1_type]').on('change', function(){ + let f_type = $(this).val() + console.log(f_type) + if (f_type == 'bm'){ + $('.grad_control').hide() + $('input[name=cm13q][value=ANNO]').prop("checked", true); + $('input[name=cm14q][value=ANNO]').prop("checked", true); + }else if (f_type=='hhrcpa'){ + $('.grad_control').show() + $('input[name=cm13q][value=ANNO]').prop("checked", true); + $('input[name=cm14q][value=ANNO]').prop("checked", true); + + } +}) +$('input[type=radio]').on('change', function(){ + ben_m1 = $('input[name=cm1q]:checked').val() + if(ben_m1=='AYES'){benchmark_1 = 1}else{benchmark_1 = 0} + ben_m2 = $('input[name=cm2q]:checked').val() + if(ben_m2=='AYES'){benchmark_2 = 1}else{benchmark_2 = 0} + ben_m3 = $('input[name=cm3q]:checked').val() + if(ben_m3=='AYES'){benchmark_3 = 1}else{benchmark_3 = 0} + ben_m4 = $('input[name=cm4q]:checked').val() + if(ben_m4=='AYES'){benchmark_4 = 1}else{benchmark_4 = 0} + ben_m5 = $('input[name=cm5q]:checked').val() + if(ben_m5=='AYES'){benchmark_5 = 1}else{benchmark_5 = 0} + ben_m6 = $('input[name=cm6q]:checked').val() + if(ben_m6=='AYES'){benchmark_6 = 1}else{benchmark_6 = 0} + ben_m7 = $('input[name=cm7q]:checked').val() + if(ben_m7=='AYES'){benchmark_7 = 1}else{benchmark_7 = 0} + ben_m8 = $('input[name=cm8q]:checked').val() + if(ben_m8=='AYES'){benchmark_8 = 1}else{benchmark_8 = 0} + ben_m9 = $('input[name=cm9q]:checked').val() + if(ben_m9=='AYES'){benchmark_9 = 1}else{benchmark_9 = 0} + + total_score = benchmark_1+benchmark_2+benchmark_3+benchmark_4+benchmark_5+benchmark_6+benchmark_7+benchmark_8+benchmark_9 + + console.log(total_score) + $('#total_score').html(total_score+' / 9 ') + + if (total_score >= 8){ + $('input[name=cm13q][value=AYES]').prop("checked", true); + $('input[name=cm14q][value=AYES]').prop("checked", true); + }else{ + $('input[name=cm13q][value=ANNO]').prop("checked", true); + $('input[name=cm14q][value=ANNO]').prop("checked", true); + } +}) {% endblock lazy_javascript_code %} \ No newline at end of file diff --git a/templates/forms/new_grad_monitor_tool.html b/templates/forms/new_grad_monitor_tool.html index 2cdb24592..9adc3bb74 100644 --- a/templates/forms/new_grad_monitor_tool.html +++ b/templates/forms/new_grad_monitor_tool.html @@ -194,25 +194,31 @@

Schooled



-
- -
- {{ form.cm13q }} -
-
-
- -
- {{ form.cm14q }} -
-
+
+ +
+ {{ form.cm13q }} +
+
+
+ +
+ {{ form.cm14q }} +
+
+
+ +
+ +
+
- + Cancel
@@ -312,6 +318,64 @@

Schooled

$('#monitoring_date').datepicker({ format: 'yyyy-mm-dd' }).val(); + + $('input[name=cm13q]').prop("disabled", true); + $('input[name=cm14q]').prop("disabled", true); + + }); + +function submitActivate(){ + $('input[name=cm13q]').removeAttr('disabled') + $('input[name=cm14q]').removeAttr('disabled') +} + +$('input[name=form1_type]').on('change', function(){ + let f_type = $(this).val() + console.log(f_type) + if (f_type == 'bm'){ + $('.grad_control').hide() + $('input[name=cm13q][value=ANNO]').prop("checked", true); + $('input[name=cm14q][value=ANNO]').prop("checked", true); + }else if (f_type=='hhrcpa'){ + $('.grad_control').show() + $('input[name=cm13q][value=ANNO]').prop("checked", true); + $('input[name=cm14q][value=ANNO]').prop("checked", true); + + } +}) +$('input[type=radio]').on('change', function(){ + ben_m1 = $('input[name=cm1q]:checked').val() + if(ben_m1=='AYES'){benchmark_1 = 1}else{benchmark_1 = 0} + ben_m2 = $('input[name=cm2q]:checked').val() + if(ben_m2=='AYES'){benchmark_2 = 1}else{benchmark_2 = 0} + ben_m3 = $('input[name=cm3q]:checked').val() + if(ben_m3=='AYES'){benchmark_3 = 1}else{benchmark_3 = 0} + ben_m4 = $('input[name=cm4q]:checked').val() + if(ben_m4=='AYES'){benchmark_4 = 1}else{benchmark_4 = 0} + ben_m5 = $('input[name=cm5q]:checked').val() + if(ben_m5=='AYES'){benchmark_5 = 1}else{benchmark_5 = 0} + ben_m6 = $('input[name=cm6q]:checked').val() + if(ben_m6=='AYES'){benchmark_6 = 1}else{benchmark_6 = 0} + ben_m7 = $('input[name=cm7q]:checked').val() + if(ben_m7=='AYES'){benchmark_7 = 1}else{benchmark_7 = 0} + ben_m8 = $('input[name=cm8q]:checked').val() + if(ben_m8=='AYES'){benchmark_8 = 1}else{benchmark_8 = 0} + ben_m9 = $('input[name=cm9q]:checked').val() + if(ben_m9=='AYES'){benchmark_9 = 1}else{benchmark_9 = 0} + + total_score = benchmark_1+benchmark_2+benchmark_3+benchmark_4+benchmark_5+benchmark_6+benchmark_7+benchmark_8+benchmark_9 + + console.log(total_score) + $('#total_score').html(total_score+' / 9 ') + + if (total_score >= 8){ + $('input[name=cm13q][value=AYES]').prop("checked", true); + $('input[name=cm14q][value=AYES]').prop("checked", true); + }else{ + $('input[name=cm13q][value=ANNO]').prop("checked", true); + $('input[name=cm14q][value=ANNO]').prop("checked", true); + } +}) {% endblock lazy_javascript_code %} \ No newline at end of file From 2427b935b3067f7186919acc6ea91ab08b0197fc Mon Sep 17 00:00:00 2001 From: Boniface M Date: Wed, 3 Aug 2022 08:34:21 +0300 Subject: [PATCH 4/4] Benchmark monitoring doesn't graduate --- templates/forms/edit_grad_monitor_tool.html | 5 +++-- templates/forms/new_grad_monitor_tool.html | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/templates/forms/edit_grad_monitor_tool.html b/templates/forms/edit_grad_monitor_tool.html index 975bae9e3..9688ccd03 100644 --- a/templates/forms/edit_grad_monitor_tool.html +++ b/templates/forms/edit_grad_monitor_tool.html @@ -297,8 +297,9 @@

Schooled

console.log(total_score) $('#total_score').html(total_score+' / 9 ') - - if (total_score >= 8){ + + let form_type = $('input[name=form1_type]').val() + if (total_score >= 8 && form_type == 'hhrcpa'){ $('input[name=cm13q][value=AYES]').prop("checked", true); $('input[name=cm14q][value=AYES]').prop("checked", true); }else{ diff --git a/templates/forms/new_grad_monitor_tool.html b/templates/forms/new_grad_monitor_tool.html index 9adc3bb74..1e11abe51 100644 --- a/templates/forms/new_grad_monitor_tool.html +++ b/templates/forms/new_grad_monitor_tool.html @@ -369,7 +369,8 @@

Schooled

console.log(total_score) $('#total_score').html(total_score+' / 9 ') - if (total_score >= 8){ + let form_type = $('input[name=form1_type]').val() + if (total_score >= 8 && form_type == 'hhrcpa'){ $('input[name=cm13q][value=AYES]').prop("checked", true); $('input[name=cm14q][value=AYES]').prop("checked", true); }else{