<commit_before>angular.module('example-app', ['weekly']);

var MainController = function($scope) {

  var today = new Date();
  var event1 = {
    start: new Date(today.getFullYear(), today.getMonth(), today.getDate(), 10),
    end: new Date(today.getFullYear(), today.getMonth(), today.getDate(), 12),
    id: '123'
  }
  var event2 = {
    start: new Date(today.getFullYear(), today.getMonth(), today.getDate(), 13),
    end: new Date(today.getFullYear(), today.getMonth(), today.getDate(), 15),
    id: '456'
  }
  var event3 = {
    start: new Date(today.getFullYear(), today.getMonth(), today.getDate(), 16),
    end: new Date(today.getFullYear(), today.getMonth(), today.getDate(), 17),
    id: '456'
  }

  $scope.events = [];//[event1, event2];

  $scope.addEvent = function(evnt) {
    console.log('event added', evnt);
  }

  $scope.removeEvent = function(evnt) {
    console.log('event removed', evnt);
  }

  $scope.addAnotherEvent = function() {
    $scope.events.push(event3);
  }

  $scope.eventClick = function(evnt, el) {
    evnt.title = 'Clicked';
    evnt.type = 'clicked';
    console.log('click', evnt, el);
  };

  $scope.weekChanged = function(data) {
    console.log('week changed', data);
  }
<commit_msg>[example] check if evnt exists before updating<commit_after>angular.module('example-app', ['weekly']);

var MainController = function($scope) {

  var today = new Date();
  var event1 = {
    start: new Date(today.getFullYear(), today.getMonth(), today.getDate(), 10),
    end: new Date(today.getFullYear(), today.getMonth(), today.getDate(), 12),
    id: '123'
  }
  var event2 = {
    start: new Date(today.getFullYear(), today.getMonth(), today.getDate(), 13),
    end: new Date(today.getFullYear(), today.getMonth(), today.getDate(), 15),
    id: '456'
  }
  var event3 = {
    start: new Date(today.getFullYear(), today.getMonth(), today.getDate(), 16),
    end: new Date(today.getFullYear(), today.getMonth(), today.getDate(), 17),
    id: '456'
  }

  $scope.events = [];//[event1, event2];

  $scope.addEvent = function(evnt) {
    console.log('event added', evnt);
  }

  $scope.removeEvent = function(evnt) {
    console.log('event removed', evnt);
  }

  $scope.addAnotherEvent = function() {
    $scope.events.push(event3);
  }

  $scope.eventClick = function(evnt, el) {
    if (evnt) {
      evnt.title = 'Clicked';
      evnt.type = 'clicked';
    }
    console.log('click', evnt, el);
  };

  $scope.weekChanged = function(data) {
    console.log('week changed', data);
  }

{'fraction_non_alphanumeric': 0.18643395477984925, 'fraction_numerical': 0.021420071400238, 'mean_word_length': 3.610603290676417, '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': '1493170', 'n_tokens_mistral': 931, 'n_tokens_neox': 865, 'n_words': 184}