Commit 22d47dcb3a4c45fce3df9bba5491873204441d99

Authored by Tomasz Bartosiak
2 parents ab075a7a 3e9f87b7

Merge branch 'tomek' into dev

Showing 1 changed file with 16 additions and 13 deletions
semantics/views.py
... ... @@ -225,6 +225,8 @@ def create_frames_context(lemma_id, user):
225 225 else:
226 226 lemma_info = {"include": False}
227 227 frame_display["frames"].append({"frame_id": str(frame.id), "colspan": str(max(len(frame_roles), 1)), "rowspan": str(frame_preferences_rowspan), "status": status, "display": display, "lemma": lemma_info})
  228 +
  229 + schemata_ids = [f.id for f in lemma.frames.all()]
228 230  
229 231 for complement, complement_class in zip(frame_complements, frame_ids):
230 232 if complement_class not in complement_arguments:
... ... @@ -232,19 +234,20 @@ def create_frames_context(lemma_id, user):
232 234  
233 235 for schema_position in complement.realizations.all():
234 236 schema = schema_position.frame
235   - position = schema_position.position
236   - argument = schema_position.argument
237   - alternation = schema_position.alternation
238   - realization_id = u'schema_' + str(schema.id) + u'_pos_' + str(position.id) + '_arg_' + str(argument.id) + '_' + 'alt_' + str(alternation) + '_'
239   - complement_arguments[complement_class].append(realization_id)
240   - if realization_id not in arguments_frame_connected:
241   - arguments_frame_connected[realization_id] = []
242   - arguments_frame_connected[realization_id].append('frame_' + str(frame.id) + '_')
243   - if schema.id in alternations[frame.id]:
244   - alternations[frame.id][schema.id] = max(alternations[frame.id][schema.id], alternation)
245   - else:
246   - alternations[frame.id][schema.id] = alternation
247   - # alternations[frame.id] = {}
  237 + if schema.id in schemata_ids:
  238 + position = schema_position.position
  239 + argument = schema_position.argument
  240 + alternation = schema_position.alternation
  241 + realization_id = u'schema_' + str(schema.id) + u'_pos_' + str(position.id) + '_arg_' + str(argument.id) + '_' + 'alt_' + str(alternation) + '_'
  242 + complement_arguments[complement_class].append(realization_id)
  243 + if realization_id not in arguments_frame_connected:
  244 + arguments_frame_connected[realization_id] = []
  245 + arguments_frame_connected[realization_id].append('frame_' + str(frame.id) + '_')
  246 + if schema.id in alternations[frame.id]:
  247 + alternations[frame.id][schema.id] = max(alternations[frame.id][schema.id], alternation)
  248 + else:
  249 + alternations[frame.id][schema.id] = alternation
  250 + # alternations[frame.id] = {}
248 251  
249 252  
250 253 frames_display.append(frame_display)
... ...