annotation_service/commit

Check if Head variable is instanciated, allowing to add annotation without committing.

authorChris Dijkshoorn
Sun Apr 3 16:15:53 2016 +0200
committerChris Dijkshoorn
Sun Apr 3 16:15:53 2016 +0200
commit04c534eaf68e7e271cbb717c259b7fbd67e46342
tree0d942990feb490466c2b258a4b730e6391207286
parent1f000d7f470a297b300498ebebaed54db78bcbf4
Diff style: patch stat
diff --git a/api/annotation.pl b/api/annotation.pl
index 58cf92b..3450f80 100644
--- a/api/annotation.pl
+++ b/api/annotation.pl
@@ -112,10 +112,9 @@ http_add_annotation(Request) :-
 			   Head))),
 
 	enrich_annotation(Annotation, AnnotationJson),
-	reply_json(json([
-		       annotation=AnnotationJson,
-		       head=Head
-		   ])).
+	( var(Head)
+	-> reply_json(json([annotation=AnnotationJson]))
+	; reply_json(json([annotation=AnnotationJson, head=Head]))).
 
 %%	http_remove_annotation(+Request)
 %