Commit a95854ca4902d128ddc464b0f1dc9e46a66f70fc

Authored by Bartłomiej Nitoń
1 parent ac9edb28

Reconnecting semantics bugfixes.

common/js_to_obj.py
... ... @@ -44,7 +44,6 @@ def jsFrameToObj(frame, lemma_entry):
44 44 if len(position['arguments']) > 0:
45 45 pos_obj = jsPosToObj(position)
46 46 positions_objs.append(pos_obj)
47   - position['id'] = pos_obj.id
48 47  
49 48 sorted_positions = []
50 49 sorted_pos_dict = sortPositions(positions_objs)
... ...
dictionary/saving.py
... ... @@ -20,9 +20,9 @@ def get_semantic_operations(lemma, schemata_conversions):
20 20  
21 21 def get_reconnect_operations_and_extend_connections(connections, schema, js_schema):
22 22 operations = []
  23 + used_poss_ids = []
23 24 for js_position in js_schema['positions']:
24   - #position = jsPosToObj(js_position)
25   - position = schema.positions.get(id=js_position['id'])
  25 + position = get_position(schema, js_position, used_poss_ids)
26 26 for js_phrase_type in js_position['arguments']:
27 27 phrase_type = Argument.objects.get(id=js_phrase_type['id'])
28 28 new_connection_target = {'schema': schema,
... ... @@ -39,6 +39,14 @@ def get_reconnect_operations_and_extend_connections(connections, schema, js_sche
39 39 'realizations': conn['realizations']})
40 40 return operations
41 41  
  42 +def get_position(schema, js_position, used_poss_ids):
  43 + position = jsPosToObj(js_position)
  44 + same_poss = schema.positions.filter(text_rep=position.text_rep)
  45 + unused_same_poss = same_poss.exclude(id__in=used_poss_ids)
  46 + position = unused_same_poss[0]
  47 + used_poss_ids.append(position.id)
  48 + return position
  49 +
42 50 def reconnect_operations(connection, new_target):
43 51 operations = []
44 52 compl = Complement.objects.get(id=connection['compl'])
... ...
dictionary/static/js/semantics_coupling.js
... ... @@ -91,5 +91,5 @@ function clearPositionConnections(position) {
91 91 }
92 92  
93 93 function clearPhraseTypeConnections(phraseType) {
94   - phraseType.complements = [];
  94 + phraseType.connections = [];
95 95 }
... ...