<commit_before>HospitalCheckup.module("InfectionsApp.Show", function(Show, HospitalCheckup, Backbone, Marionette, $, _){
  Show.Controller = {
    showHospital: function(id, aboutView, chartsView){ //received URL with ID parameter, or selected from viz

      var fetchingHospital = HospitalCheckup.request("hospital:entity", id);
      $.when(fetchingHospital).done(function(hospital){
        if(hospital !== undefined){
          aboutView.model = hospital;
          chartsView.collection.reset(chartsView.get_hospital_models(hospital));
        } else {
           //we should only end up here if someone goes to a URL 
          //with an ID that none of our hospitals have (that shouldn't happen);
          aboutView = new Show.MissingHospital();
        }

        aboutView.render();
        chartsView.render();
      });
    }
  }
});<commit_msg>Don't rerender hospital details if model hasn't changed<commit_after>HospitalCheckup.module("InfectionsApp.Show", function(Show, HospitalCheckup, Backbone, Marionette, $, _){
  Show.Controller = {
    showHospital: function(id, aboutView, chartsView){ //received URL with ID parameter, or selected from viz

      var fetchingHospital = HospitalCheckup.request("hospital:entity", id);
      $.when(fetchingHospital).done(function(hospital){
        if(hospital !== undefined){
          if(aboutView.model){
            if(aboutView.model.get("id") !== hospital.get("id")){ //don't rerender if active hospital clicked again
              changeModels();
            }
          } else {
            changeModels();
          }
        } else {
           //we should only end up here if someone goes to a URL 
          //with an ID that none of our hospitals have (that shouldn't happen);
          aboutView = new Show.MissingHospital().render();
        }

        function changeModels(){
          aboutView.model = hospital;
          chartsView.collection.reset(chartsView.get_hospital_models(hospital));
          aboutView.render();
        }
      });
    }
  }
});
{'fraction_non_alphanumeric': 0.1146089522872602, 'fraction_numerical': 0.0, 'mean_word_length': 2.658273381294964, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1457328', 'n_tokens_mistral': 553, 'n_tokens_neox': 521, 'n_words': 139}