<commit_before>Template.foundbill.created = function(){
  Meteor.subscribe("allbills");
  Session.set('message', '');
};

Template.foundbill.events({
  "submit form": function(e){
     e.preventDefault();


     var serial = e.target.serialnumber.value;
     serial = serial.toLowerCase();
     var zip = e.target.zip.value;
     var have = e.target.have.checked;
     var note = e.target.note.value;
     var email = Meteor.user().emails[0].address;


     var thisbill = bills.findOne({serial: serial});

     // check to see if this bill exists
     if (thisbill){
       var billId = thisbill._id;

       bills.update({_id:billId},
       {$push: {
         "history": {
           timestamp: new Date(),
           zip: zip,
           recordedby: Meteor.userId(),
           note: note
         }
       }
      });


      e.target.serialnumber.value = '';
      e.target.zip.value = '';
      e.target.note.value = '';
      e.target.have.checked = false;

      Session.set('message', '<div class="no-data alert alert-success">Thanks for registering this bill!</div>')
    }else{
      Session.set('message', '<div class="no-data alert alert-danger">Couldn\'t find this bill in our records. <a href="/new-bill">Register it as new here!</a></div>');
    }


<commit_msg>Add quotes around a query variable to work better with Mongo.<commit_after>Template.foundbill.created = function(){
  Meteor.subscribe("allbills");
  Session.set('message', '');
};

Template.foundbill.events({
  "submit form": function(e){
     e.preventDefault();


     var serial = e.target.serialnumber.value;
     serial = serial.toLowerCase();
     var zip = e.target.zip.value;
     var have = e.target.have.checked;
     var note = e.target.note.value;
     var email = Meteor.user().emails[0].address;


     var thisbill = bills.findOne({'serial': serial});

     // check to see if this bill exists
     if (thisbill){
       var billId = thisbill._id;

       bills.update({_id:billId},
       {$push: {
         "history": {
           timestamp: new Date(),
           zip: zip,
           recordedby: Meteor.userId(),
           note: note
         }
       }
      });


      e.target.serialnumber.value = '';
      e.target.zip.value = '';
      e.target.note.value = '';
      e.target.have.checked = false;

      Session.set('message', '<div class="no-data alert alert-success">Thanks for registering this bill!</div>')
    }else{
      Session.set('message', '<div class="no-data alert alert-danger">Couldn\'t find this bill in our records. <a href="/new-bill">Register it as new here!</a></div>');
    }



{'fraction_non_alphanumeric': 0.15605828220858894, 'fraction_numerical': 0.0007668711656441718, 'mean_word_length': 2.441952506596306, 'pattern_counts': {'":': 4, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4407442', 'n_tokens_mistral': 825, 'n_tokens_neox': 788, 'n_words': 182}