<commit_before>"use strict";

var adp = adp || {};

adp.determination = {
  init : function(container_id) {
    this.addChangeEvent(container_id);
  },
  calculateAmount: function(fee, expenses) {

    var f = fee || 0,
      e = expenses || 0;
    f = f < 0 ? 0 : f;
    e = e < 0 ? 0 : e;
    var t = (f + e).toFixed(2);
    t = t < 0 ? 0 : t;
    return t;

  },
  addChangeEvent: function(container_id) {
    $('#' + container_id).on('change', '#claim_assessment_attributes_fees, #claim_assessment_attributes_expenses', function(e) {
      var fees = parseFloat($('#claim_assessment_attributes_fees').val());
      var expenses = parseFloat($('#claim_assessment_attributes_expenses').val());
      var total = adp.determination.calculateAmount(fees,expenses);
      if (isNaN(total) ){
        $('.total-determination').text('£0.00');
      }
      else{
        $('.total-determination').text('£ '+ total);
      }
    });
  }
};
<commit_msg>Allow commas in assessment fees and expenses values<commit_after>"use strict";

var adp = adp || {};

adp.determination = {
  init : function(container_id) {
    this.addChangeEvent(container_id);
  },
  calculateAmount: function(fee, expenses) {

    var f = fee || 0,
      e = expenses || 0;
    f = f < 0 ? 0 : f;
    e = e < 0 ? 0 : e;
    var t = (f + e).toFixed(2);
    t = t < 0 ? 0 : t;
    return t;

  },
  addChangeEvent: function(container_id) {
    $('#' + container_id).on('change', '#claim_assessment_attributes_fees, #claim_assessment_attributes_expenses', function(e) {
      
      var fees = parseFloat($('#claim_assessment_attributes_fees').val().replace(/,/g, ""));
      var expenses = parseFloat($('#claim_assessment_attributes_expenses').val().replace(/,/g, ""));
      var total = adp.determination.calculateAmount(fees,expenses);
      if (isNaN(total) ){
        $('.total-determination').text('£0.00');
      }
      else{
        $('.total-determination').text('£ '+ total);
      }
    });
  }
};

{'fraction_non_alphanumeric': 0.17721518987341772, 'fraction_numerical': 0.012151898734177215, 'mean_word_length': 3.024439918533605, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5832538', 'n_tokens_mistral': 699, 'n_tokens_neox': 662, 'n_words': 129}