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,20 +185,13 @@
'listId': listId,
'ngramId': $scope.selection_text.uuid
}).$promise.then(function(data) {
// push to $rootScope.annotations
if (data && data.uuid && data.text && data.list_id) {
// new annotation is returned and added to the $rootScope
$rootScope.annotations.push(data);
} 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'];
});
$.each($rootScope.annotations, function(index, element) {
if (element.list_id == listId && element.uuid == $scope.selection_text.uuid) {
$rootScope.annotations.splice(index, 1);
return false;
}
});
});
} else if ($scope.selection_text.trim() !== "") {
// new annotation from selection
......
......@@ -61,7 +61,7 @@
},
delete: {
method: 'DELETE',
params: {'listId': '@listId', 'ngramId': '@ngramId'}
params: {'listId': '@listId', 'ngramId': '@id'}
}
}
);
......
......@@ -106,8 +106,8 @@ class NgramEdit(APIView):
"""
Delete a ngram from a list
"""
return Response({ 'delete' : { '%s' % ngram_id :
ngramList(do='del', ngram_ids=[ngram_id], list_id=list_id)}})
session.query(Node_Ngram).filter(Node_Ngram.node_id==list_id).filter(Node_Ngram.ngram_id==ngram_id).delete()
return Response(None, 204)
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