<commit_before>'use strict';

var nevernoteBasePath = 'https://nevernote-1150.herokuapp.com/api/v1/',
    apiKey = <KEY>';

var noteApp = angular.module('notely.notes', ['ngRoute']);

noteApp.config(['$routeProvider', function($routeProvider) {
  $routeProvider.when('/notes', {
    templateUrl: 'notes/notes.html'
  });
}]);

noteApp.controller('NotesController', ['$scope', 'NotesBackend', function($scope, NotesBackend) {
  var self = this;
  $scope.note = {};
  $scope.notes = [];

  self.assignNotes = function(notes) {
    $scope.notes = notes;
  };

  $scope.commit = function() {
    NotesBackend.postNote($scope.note, self.assignNotes);
  };

  $scope.hasNotes = function() {
    return $scope.notes.length > 0;
  };

  $scope.loadNote = function(note) {
    $scope.note = self.cloneNote(note);
  };

  NotesBackend.fetchNotes(self.assignNotes);
}]);<commit_msg>Load existing notes into the form.<commit_after>'use strict';

var nevernoteBasePath = 'https://nevernote-1150.herokuapp.com/api/v1/',
    apiKey = <KEY>';

var noteApp = angular.module('notely.notes', ['ngRoute']);

noteApp.config(['$routeProvider', function($routeProvider) {
  $routeProvider.when('/notes', {
    templateUrl: 'notes/notes.html'
  });
}]);

noteApp.controller('NotesController', ['$scope', 'NotesBackend', function($scope, NotesBackend) {
  var self = this;
  $scope.note = {};
  $scope.notes = [];

  self.assignNotes = function(notes) {
    $scope.notes = notes;
  };

  self.findNoteById = function(noteId) {
    for (var i = 0; i < $scope.notes.length; i++) {
      if ($scope.notes[i].id === noteId) {
        return $scope.notes[i];
      }
    }
  };

  self.cloneNote = function(note) {
    return JSON.parse(JSON.stringify(note));
  };

  $scope.commit = function() {
    NotesBackend.postNote($scope.note, self.assignNotes);
  };

  $scope.hasNotes = function() {
    return $scope.notes.length > 0;
  };

  $scope.loadNote = function(note) {
    $scope.note = self.cloneNote(note);
  };

  NotesBackend.fetchNotes(self.assignNotes);
}]);
{'fraction_non_alphanumeric': 0.18645731108930325, 'fraction_numerical': 0.006378802747791953, 'mean_word_length': 3.8663484486873507, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '4181490', 'n_tokens_mistral': 713, 'n_tokens_neox': 687, 'n_words': 111}