Commit f7e76d7066fffa075f5e717a2e68c71b47684652
1 parent
66c280ba
Semantic validation of used schemata bugfix.
Showing
1 changed file
with
11 additions
and
1 deletions
semantics/validation.py
... | ... | @@ -237,10 +237,20 @@ def lemma_always_pinned(frame): |
237 | 237 | def validate_schemas(lemma_id): |
238 | 238 | error_msg = '' |
239 | 239 | lemma = Lemma.objects.get(id=lemma_id, old=False) |
240 | - if not all_schemas_used(lemma): | |
240 | + if missing_schemata_opinions(lemma): | |
241 | + error_msg = u'Nie wszystkie schematy mają wybrane oceny.' | |
242 | + elif not all_schemas_used(lemma): | |
241 | 243 | error_msg = u'Semantyka nie wykorzystuje wszystkich poprawnych schematów walencyjnych.' |
242 | 244 | return error_msg |
243 | 245 | |
246 | +def missing_schemata_opinions(lemma): | |
247 | + schemata = lemma.frames | |
248 | + for schema in schemata.all(): | |
249 | + schema_opinion = lemma.frame_opinions.filter(frame=schema) | |
250 | + if not schema_opinion.exists(): | |
251 | + return True | |
252 | + return False | |
253 | + | |
244 | 254 | def all_schemas_used(lemma): |
245 | 255 | frames = lemma.entry_obj.visible_frames() |
246 | 256 | schemas = lemma.frames |
... | ... |