diff --git a/edivorce/apps/core/static/js/main.js b/edivorce/apps/core/static/js/main.js
index 425bed48..e9b690e3 100755
--- a/edivorce/apps/core/static/js/main.js
+++ b/edivorce/apps/core/static/js/main.js
@@ -805,7 +805,13 @@ var replaceSuffix = function(str, suffix) {
// data-mirror_broadcast_change=[true|false] - after change the target element will trigger a change event so
// so any listener attached to target element are notified that
// contents have changed.
-var mirrorOnChange = function() {
+var mirrorOnChange = function(e) {
+ // Don't mirror the change if the keypressed was tab. This is to prevent unnecessary calculations that may result
+ // in some fields changing because scaling up to annual produces a slightly different result, due to rounding, than
+ // scaling down.
+ if (e.which === 9) {
+ return;
+ }
var target_select = $(this).attr("data-mirror_target");
var scale_factor_identifier = $(this).attr("data-mirror_scale");
var broadcast_change = $(this).attr("data-mirror_broadcast_change");
diff --git a/edivorce/apps/core/templates/question/06_children_income_expenses.html b/edivorce/apps/core/templates/question/06_children_income_expenses.html
index 91624036..32300c4d 100644
--- a/edivorce/apps/core/templates/question/06_children_income_expenses.html
+++ b/edivorce/apps/core/templates/question/06_children_income_expenses.html
@@ -424,7 +424,7 @@
- {% money_input_field name="child_care_expenses" id="child_care_expenses_month" class="fact-sheet-input money extraordinary-expense-monthly" data_mirror_on_pressed="true" data_mirror_target="#child_care_expenses_year" data_mirror_scale="year_up" data_mirror_broadcast_change="true" scale_to_monthly="true" %}
+ {% money_input_field name="child_care_expenses" id="child_care_expenses_month" class="fact-sheet-input money extraordinary-expense-monthly" data_mirror_on_pressed="true" data_mirror_target="#child_care_expenses_year" data_mirror_scale="year_up" data_mirror_broadcast_change="true" %}
|
@@ -439,7 +439,7 @@
|
- {% money_input_field name="children_healthcare_premiums" id="children_healthcare_premiums_month" class="fact-sheet-input money extraordinary-expense-monthly" data_mirror_on_pressed="true" data_mirror_target="#children_healthcare_premiums_year" data_mirror_scale="year_up" scale_to_monthly="true" data_mirror_broadcast_change="true" %}
+ {% money_input_field name="children_healthcare_premiums" id="children_healthcare_premiums_month" class="fact-sheet-input money extraordinary-expense-monthly" data_mirror_on_pressed="true" data_mirror_target="#children_healthcare_premiums_year" data_mirror_scale="year_up" data_mirror_broadcast_change="true" %}
|
@@ -464,7 +464,7 @@
|
- {% money_input_field name="health_related_expenses" id="health_related_expenses_month" class="fact-sheet-input money extraordinary-expense-monthly" data_mirror_on_pressed="true" data_mirror_target="#health_related_expenses_year" data_mirror_scale="year_up" scale_to_monthly="true" data_mirror_broadcast_change="true" %}
+ {% money_input_field name="health_related_expenses" id="health_related_expenses_month" class="fact-sheet-input money extraordinary-expense-monthly" data_mirror_on_pressed="true" data_mirror_target="#health_related_expenses_year" data_mirror_scale="year_up" data_mirror_broadcast_change="true" %}
|
@@ -489,7 +489,7 @@
|
- {% money_input_field name="extraordinary_educational_expenses" id="extraordinary_educational_expenses_month" class="fact-sheet-input money extraordinary-expense-monthly" data_mirror_on_pressed="true" data_mirror_target="#extraordinary_educational_expenses_year" data_mirror_scale="year_up" scale_to_monthly="true" data_mirror_broadcast_change="true" %}
+ {% money_input_field name="extraordinary_educational_expenses" id="extraordinary_educational_expenses_month" class="fact-sheet-input money extraordinary-expense-monthly" data_mirror_on_pressed="true" data_mirror_target="#extraordinary_educational_expenses_year" data_mirror_scale="year_up" data_mirror_broadcast_change="true" %}
|
@@ -503,7 +503,7 @@
| Post-secondary school expenses |
- {% money_input_field name="post_secondary_expenses" id="post_secondary_expenses_month" class="fact-sheet-input extraordinary-expense-monthly" data_mirror_on_pressed="true" data_mirror_target="#post_secondary_expenses_year" data_mirror_scale="year_up" scale_to_monthly="true" data_mirror_broadcast_change="true" %}
+ {% money_input_field name="post_secondary_expenses" id="post_secondary_expenses_month" class="fact-sheet-input extraordinary-expense-monthly" data_mirror_on_pressed="true" data_mirror_target="#post_secondary_expenses_year" data_mirror_scale="year_up" data_mirror_broadcast_change="true" %}
|
@@ -530,7 +530,7 @@
|
- {% money_input_field name="extraordinary_extracurricular_expenses" id="extraordinary_extracurricular_expenses_month" class="fact-sheet-input money extraordinary-expense-monthly" data_mirror_on_pressed="true" data_mirror_target="#extraordinary_extracurricular_expenses_year" data_mirror_scale="year_up" scale_to_monthly="true" data_mirror_broadcast_change="true" %}
+ {% money_input_field name="extraordinary_extracurricular_expenses" id="extraordinary_extracurricular_expenses_month" class="fact-sheet-input money extraordinary-expense-monthly" data_mirror_on_pressed="true" data_mirror_target="#extraordinary_extracurricular_expenses_year" data_mirror_scale="year_up" data_mirror_broadcast_change="true" %}
|
@@ -544,7 +544,7 @@
| Total section 7 expenses |
- {% money_input_field name="total_section_seven_expenses" id="total_extraordinary_expense_monthly" class="fact-sheet-input money " readonly="" scale_to_monthly="true" %}
+ {% money_input_field name="total_section_seven_expenses" id="total_extraordinary_expense_monthly" class="fact-sheet-input money " readonly="" %}
|
diff --git a/edivorce/apps/core/templatetags/input_field.py b/edivorce/apps/core/templatetags/input_field.py
index 8db9497d..46f9e005 100644
--- a/edivorce/apps/core/templatetags/input_field.py
+++ b/edivorce/apps/core/templatetags/input_field.py
@@ -1,5 +1,4 @@
from datetime import datetime
-from decimal import Decimal, ROUND_HALF_UP
import json
from django import template
@@ -10,7 +9,7 @@ register = template.Library()
@register.simple_tag(takes_context=True)
-def money_input_field(context, input_type='number', name='', value_src=None, value='', scale_factor=None, scale_to_monthly=None, **kwargs):
+def money_input_field(context, input_type='number', name='', value_src=None, value='', scale_factor=None, **kwargs):
"""
:param context:
@@ -32,8 +31,6 @@ def money_input_field(context, input_type='number', name='', value_src=None, val
if scale_factor:
value = float(value) * float(scale_factor)
- if scale_to_monthly:
- value = Decimal(float(value) / 12).quantize(Decimal('.01'), rounding=ROUND_HALF_UP)
step = '0.01'
if kwargs.get('step', None):