Skip to content
Snippets Groups Projects
Commit 8efeabb4 authored by dcz's avatar dcz
Browse files

All preference adding constraint.

parent 70a6c2fb
Branches
No related tags found
No related merge requests found
......@@ -352,8 +352,7 @@ export default class SelectionalPreference {
synset_hierarchy_conflict_alert(response) {
const conflict_exists = response.conflict_exists;
if (conflict_exists != null) {
alert('Wybrana preferencja selekcyjna nie mogła zostać zapisana ponieważ widnieje już na liście preferencji selekcyjnych: ' +
conflict_exists)
alert(conflict_exists)
} else {
const conflict_hyponym = response.conflict_hyponym;
const conflict_hyperonym = response.conflict_hyperonym;
......
......@@ -88,7 +88,7 @@ def check_sysnet_hierarchy_constraints(synset_preference_ids, unified_frame_argu
return {"succ": False, "conflict_hyponym": conflict_hyponym_lu_str,
"conflict_hyperonym": conflict_hyperonym_lu_str,
"conflict_exists": conflict_exists_lu_str}
"conflict_exists": "Wybrana preferencja selekcyjna nie mogła zostać zapisana ponieważ widnieje już na liście preferencji selekcyjnych: " + conflict_exists_lu_str}
return {"succ": True}
......@@ -111,7 +111,13 @@ def save_predefined_preference(request):
unified_frame_argument = UnifiedFrameArgument.objects.get(unified_frame_id=int(frame_id), id=int(complement_id))
predefined_synset_ids = []
get_predefined_preference_synsets([PredefinedSelectionalPreference.objects.get(id=predefined_preference_id)], predefined_synset_ids)
pred_sel_pref = PredefinedSelectionalPreference.objects.get(id=predefined_preference_id)
if pred_sel_pref.name == 'ALL' and len(unified_frame_argument.predefined.all()) > 0:
return JsonResponse({"succ": False, "conflict_hyponym": None,
"conflict_hyperonym": None,
"conflict_exists": "Predefiniowana preferencja selekcyjna ALL może być dodana tylko, gdy nie na liście nie widnieją inne preferencje selekcyjne."})
else:
get_predefined_preference_synsets([pred_sel_pref], predefined_synset_ids)
check_sysnet_hierarchy_constraints_ret = check_sysnet_hierarchy_constraints(predefined_synset_ids, unified_frame_argument)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment