Commit addc6e19 authored by Mathieu Rodic's avatar Mathieu Rodic

[BUG] removing ngrams from stop- or miamlist now works from the interface

parent 3aa44ef1
...@@ -185,19 +185,12 @@ ...@@ -185,19 +185,12 @@
'listId': listId, 'listId': listId,
'ngramId': $scope.selection_text.uuid 'ngramId': $scope.selection_text.uuid
}).$promise.then(function(data) { }).$promise.then(function(data) {
// push to $rootScope.annotations $.each($rootScope.annotations, function(index, element) {
if (data && data.uuid && data.text && data.list_id) { if (element.list_id == listId && element.uuid == $scope.selection_text.uuid) {
// new annotation is returned and added to the $rootScope $rootScope.annotations.splice(index, 1);
$rootScope.annotations.push(data); return false;
} else { }
// refresh all annotations });
NgramListHttpService.get(
{'corpusId': $rootScope.corpusId, 'docId': $rootScope.docId}
).$promise.then(function(data) {
$rootScope.annotations = data[$rootScope.corpusId.toString()][$rootScope.docId.toString()];
$rootScope.lists = data[$rootScope.corpusId.toString()]['lists'];
});
}
}); });
} else if ($scope.selection_text.trim() !== "") { } else if ($scope.selection_text.trim() !== "") {
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
}, },
delete: { delete: {
method: 'DELETE', method: 'DELETE',
params: {'listId': '@listId', 'ngramId': '@ngramId'} params: {'listId': '@listId', 'ngramId': '@id'}
} }
} }
); );
......
...@@ -106,8 +106,8 @@ class NgramEdit(APIView): ...@@ -106,8 +106,8 @@ class NgramEdit(APIView):
""" """
Delete a ngram from a list Delete a ngram from a list
""" """
return Response({ 'delete' : { '%s' % ngram_id : session.query(Node_Ngram).filter(Node_Ngram.node_id==list_id).filter(Node_Ngram.ngram_id==ngram_id).delete()
ngramList(do='del', ngram_ids=[ngram_id], list_id=list_id)}}) return Response(None, 204)
class Document(APIView): class Document(APIView):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment