Help with ionic v1 and Sqlite

I was following a simple to do tutorial. I have modify the code so it accepts 2 inputs instead of one but the code in not working. And I can’t see why. I think that the problem is with my sql code but not sure. Thank you for your help.

angular.module(‘starter.services’, [])

.factory(‘TarefasService’, function($q){

var db;

function createDB(){

  try {

    db = window.sqlitePlugin.openDatabase({name: 'tarefasDB.db', location: 'default'}, function(db) {
      db.transaction(function(tx) {
        db.transaction(function (tx) {
          tx.executeSql('CREATE TABLE IF NOT EXISTS tarefas (task_id INTEGER PRIMARY KEY ASC, task_name varchar(200), task_amount varchar(200))');
        });
      }, function(err) {
        alert('Open database ERROR: ' + JSON.stringify(err));
      });
    });
  }catch (err){
    alert('Error: ' + error);
  }
  console.log('database open');
}

function read(){
  return promessaQuery('SELECT * from tarefas',
    callBackSucesso, callBackErro);
}

function create(name, amount){
  return promessaQuery('INSERT INTO tarefas(task_name, task_amount) VALUES ("' + name + ', ' + amount + '")',
    callBackSucesso, callBackErro);
}

function update(name, id){
  return promessaQuery('UPDATE tarefas SET task_name = "' + name +'", task_amount= "' + amount +'" WHERE task_id = ' + id,
    callBackSucesso, callBackErro);
}

function deleteTarefa(id){
  return promessaQuery('DELETE FROM tarefas WHERE task_id = ' + id,
    callBackSucesso, callBackErro);
}

function promessaQuery(query, sucessCallback, errorCallback){
    var deferido = $q.defer();
    db.transaction(function (tx) {
      tx.executeSql(query, [], sucessCallback(deferido),
        errorCallback(deferido));
    });
    return deferido.promise;
}

function callBackSucesso(deferido){
    return function (tx, results){
      var len = results.rows.length, i;
      var resultados = [];
      for (i = 0; i < len; i++) {
          var tarefa = {
              id : results.rows.item(i).task_id,
              name: results.rows.item(i).task_name,
              amount: results.rows.item(i).task_amount
          }
          resultados.push(tarefa);
        console.log(results.rows.item(i).task_name);
      }
      deferido.resolve(resultados);
    };
}

function callBackErro(deferido){
    return function (tx, results){
        var resultados = [];
        deferido.resolve(resultados);
    }
}

return {
  createDB: function(){
    return createDB();
  },
  read: function(){
    return read();
  },
  update: function(name, amount, id){
    return update(name, amount, id);
  },
  create: function(name, amount){
    return create(name, amount);
  },
  deleteTarefa: function(id){
    return deleteTarefa(id);
  }
}

});

angular.module(‘starter.controllers’, [‘ionic’])

.controller(‘MyCtrl’, function($scope, TarefasService) {

$scope.data = {
showDelete: false
};

document.addEventListener(‘deviceready’, onDeviceReady, false);

function onDeviceReady() {
TarefasService.createDB();
$scope.readTarefas();
}

//$scope.items = TarefasService.read();

$scope.readTarefas = function(){
TarefasService.read().then(function(resultados){
$scope.items = resultados;
});
}

$scope.add = function() {
var task = prompt(‘Enter a name’);
var task1 = prompt(‘Enter value’);
if (task){
TarefasService.create(task, task1).then(function(){
$scope.readTarefas();
});
}
};

$scope.edit = function(item) {
var task = prompt(‘Enter a name’);
var task1 = prompt(‘Enter value’);
if (task){
TarefasService.update(task, task1, item.id).then(function(){
$scope.readTarefas();
});
}
};

$scope.moveItem = function(item, fromIndex, toIndex) {
$scope.items.splice(fromIndex, 1);
$scope.items.splice(toIndex, 0, item);
//TarefasService.salvar($scope.items);
};

$scope.onItemDelete = function(item) {
TarefasService.deleteTarefa(item.id).then(function(){
$scope.readTarefas();
});
};

});