From: Tara L Andrews Date: Thu, 18 Jul 2013 13:33:01 +0000 (+0200) Subject: Actually delete invalid relationships on duplicate. Fixes #17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b6f3476bd55d911d9fe9132f8b0321bbe7727213;p=scpubgit%2Fstemmaweb.git Actually delete invalid relationships on duplicate. Fixes #17 --- diff --git a/root/js/relationship.js b/root/js/relationship.js index 6eb672f..c98077b 100644 --- a/root/js/relationship.js +++ b/root/js/relationship.js @@ -665,7 +665,18 @@ function draw_relation( source_id, target_id, relation_color ) { function detach_node( readings ) { // separate out the deleted relationships, discard for now - delete readings['DELETED']; + if( 'DELETED' in readings ) { + // Remove each of the deleted relationship links. + $.each( readings['DELETED'], function( idx, pair ) { + var relation_id = get_relation_id( pair[0], pair[1] ); + var relation = $( jq( relation_id ) ); + if( relation.size() == 0 ) { + relation_id = get_relation_id( pair[1], pair[0] ); + } + relation_manager.remove( relation_id ); + }); + delete readings['DELETED']; + } // add new node(s) $.extend( readingdata, readings ); // remove from existing readings the witnesses for the new nodes/readings