<commit_before>'use strict';

/**
 * @ngdoc function
 * @name applicationApp.controller:MainCtrl
 * @description
 * # MainCtrl
 * Controller of the applicationApp
 */
angular.module('applicationApp')
.controller('MainCtrl', function ($scope, pouchdb) {
  $scope.notes = [
    'Note 1',
    'Note 2',
    'Note 3'
  ];

  $scope.addNote = function () {
    $scope.notes.push($scope.note);
    $scope.note = '';
  };





});
<commit_msg>Added logic to use pouchdb (still not working quite well)<commit_after>'use strict';

/**
 * @ngdoc function
 * @name applicationApp.controller:MainCtrl
 * @description
 * # MainCtrl
 * Controller of the applicationApp
 */
angular.module('applicationApp')
.controller('MainCtrl', function ($scope, $rootScope, pouchdb) {
/*
  $scope.notes = [
    'Note 1',
    'Note 2',
    'Note 3'
  ];

  $scope.addNote = function () {
    $scope.notes.push($scope.note);
    $scope.note = '';
  };
*/

  $scope.notes = [];
  $scope.logs = [];

  $scope.addNote = function () {
   var note = $scope.note;
    var doc = {
      type: 'note',
      title: note.title,
      done: false,
      createdAt: new Date().getTime(),
      _id: new Date().toISOString()
    };
    pouchdb.put(doc)
      .then(function (note) {
        pouchdb.get(note.id)
          .then(function(note){
            $scope.notes.push({doc: note});
            $rootScope.$apply();
          });
      });
    note.title = '';
  };

  $scope.delete = function (doc, index) {
    pouchdb.remove(doc)
      .catch(function (error) {
        return error;
      })
    .then(function () {
      $scope.notes.splice(index, 1);
      $rootScope.$apply();
    });
  };

  $scope.edit = function (note) {
    var doc = {
      title : note.doc.title,
      done : note.doc.done,
      editedAt : new Date().getTime()
    };

    pouchdb.put(doc, note.doc._id, note.doc._rev)
      .then(function () {
        note.editMode = false;
        $rootScope.$apply();
      });
  };

  $scope.getAll = function () {
    pouchdb.allDocs({include_docs: true, descending: true})
      .then(function (notes){
        $scope.notes = notes.rows;
        $rootScope.$apply();
      });
  };

  $scope.logsListener = (function () {
    pouchdb.changes({
      live: true
    }).on('change', function(change) {
      $scope.logs.push(change);
      $rootScope.$apply();
    });
  })();

  $scope.getAll();






});

{'fraction_non_alphanumeric': 0.17858636553743204, 'fraction_numerical': 0.0029276453366792136, 'mean_word_length': 2.378531073446328, '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': '6869995', 'n_tokens_mistral': 819, 'n_tokens_neox': 787, 'n_words': 149}