diff --git a/financial_settlement/views.py b/financial_settlement/views.py index c0fc7c444b5571ca0fce4eafdf6f72a3ff430e5a..ac02267763264bb0bbdafe518db183361b28f5dd 100644 --- a/financial_settlement/views.py +++ b/financial_settlement/views.py @@ -78,7 +78,7 @@ def statement_detail(request, pk): :return: Redirecting to fin_statement_details """ statement = get_object_or_404(FinStatement, pk=pk) - unified_frames = statement.unified_frame + unified_frames = UnifiedFrame.objects.filter(fin_statement=statement, status=choices.FrameStatus.READY) mappings = UnifiedFrame2SlowalFrameMapping.objects.filter(unified_frame__in=unified_frames.all(), slowal_frame__status=choices.FrameStatus.READY) free_lu_frames = Frame.objects.filter(free_lu_user_assignment=statement.user, fin_statement=statement) diff --git a/frontend/src/components/unification/Unification/LexicalUnitEdit.vue b/frontend/src/components/unification/Unification/LexicalUnitEdit.vue index 194f99fca77d124b6405e10444b56b7c9a97ab55..6d689a04182e22bb130df242207960617c006cbc 100644 --- a/frontend/src/components/unification/Unification/LexicalUnitEdit.vue +++ b/frontend/src/components/unification/Unification/LexicalUnitEdit.vue @@ -501,9 +501,11 @@ Object.assign(LexicalUnitEdit, { let hasSlowalFrameArgumentMapping = false; for (let i in this.unified_frame.slowal_frame_mapping) { const slowal_frame_mapping = this.unified_frame.slowal_frame_mapping[i]; + const slowalFrame = this.frames.find(frame => frame.id === slowal_frame_mapping.slowal_frame_id); for (let j in slowal_frame_mapping.slowal_frame_argument_mapping) { const slowal_frame_argument_mapping = slowal_frame_mapping.slowal_frame_argument_mapping[j]; - if (slowal_frame_argument_mapping.unified_frame_agrument_id == this.active_unified_frame_argument.id) { + const slowalFrameArgument = slowalFrame.arguments.find(arg => arg.argument_id === slowal_frame_argument_mapping.slowal_frame_agrument_id); + if (slowal_frame_argument_mapping.unified_frame_agrument_id == this.active_unified_frame_argument.id && slowalFrameArgument.role !== "lemma") { hasSlowalFrameArgumentMapping = true; break; } @@ -639,7 +641,7 @@ Object.assign(LexicalUnitEdit, { if (Object.keys(roleDict).length === argument_cnt && hasPreferenceSelected) { //all roles are set, and are uniq - if(!this.has_full_empty_arguments()) { + if(!this.has_full_empty_or_lemma_arguments()) { //TODO: aktywne preferencje w argumencie nie znajdujÄ… siÄ™ w relacji hipo-/hiperonimii. const data = {'unified_frame_id': this.unified_frame.id}; $.ajax({ @@ -1105,7 +1107,7 @@ Object.assign(LexicalUnitEdit, { } } }, - has_full_empty_arguments() { + has_full_empty_or_lemma_arguments() { let non_empty_unified_frame_arguments = {} for (let i in this.unified_frame.slowal_frame_mapping) { const slowal_frame_mapping = this.unified_frame.slowal_frame_mapping[i]; @@ -1115,7 +1117,10 @@ Object.assign(LexicalUnitEdit, { const unified_frame_argument = this.unified_frame.arguments[j]; let unified_frame_argument_mapping = slowal_frame_mapping.slowal_frame_argument_mapping.find(o => o.unified_frame_agrument_id === unified_frame_argument.id); if (unified_frame_argument_mapping) { - non_empty_unified_frame_arguments[unified_frame_argument.id] = unified_frame_argument; + let slowal_frame_argument = slowal_frame.arguments.find(o => o.argument_id === unified_frame_argument_mapping.slowal_frame_agrument_id); + if(slowal_frame_argument.role != "lemma") { + non_empty_unified_frame_arguments[unified_frame_argument.id] = unified_frame_argument; + } } } } @@ -1493,6 +1498,7 @@ export default LexicalUnitEdit; :frame="frame" :key="frame" :selectedExamples="selectedExamples" + :showLemmaRoleAsEmpty="true" @frame-selection-changed="insideFrameSelectionChanged" /> </div> diff --git a/frontend/src/components/unification/shared/frame-components/SlowalFrameComponent.vue b/frontend/src/components/unification/shared/frame-components/SlowalFrameComponent.vue index 7de9f3870655ffad77f7973bd510457f86eb4198..8a6989580f0eb41d1eab92c1f2f48a592327fffa 100644 --- a/frontend/src/components/unification/shared/frame-components/SlowalFrameComponent.vue +++ b/frontend/src/components/unification/shared/frame-components/SlowalFrameComponent.vue @@ -5,6 +5,7 @@ props: { frame: Object, selectedExamples: Object, + showLemmaRoleAsEmpty: Boolean, }, components: {InfoTooltip}, emits: ['frameSelectionChanged'], @@ -29,7 +30,8 @@ }, computeArgumentCSS(argument) { const selectedExampleFrameArguments = this.selectedExamples && this.selectedExamples.length > 0 ? new Set(this.selectedExamples.map(e => e.argument_ids).flat()) : null; - return argument.role + ' ' + (argument.selected ? 'active' : argument.hover ? 'bg-highlight' : '') + let role = this.showLemmaRoleAsEmpty && argument.role == 'lemma' ? 'Empty' : argument.role; + return role + ' ' + (argument.selected ? 'active' : argument.hover ? 'bg-highlight' : '') + (selectedExampleFrameArguments != null ? selectedExampleFrameArguments.has(argument.id) ? 'example-yes' : 'example-no' : ''); }, hideSelectionalPreferencies() { @@ -75,7 +77,7 @@ @click.stop="selectArgument(argument)" :class="computeArgumentCSS(argument)" > - {{argument.str}} + {{showLemmaRoleAsEmpty && argument.role == 'lemma' ? 'Empty' : argument.str}} </td> </template> </tr> diff --git a/unifier/views.py b/unifier/views.py index aec67bf8e635b681ed4ab76e47254dc5f7da584b..f62704c471d938affa7a3499d2a0e3495b07810f 100644 --- a/unifier/views.py +++ b/unifier/views.py @@ -764,6 +764,15 @@ def remove_argument(request): complement_id = request.POST['complement_id'] new_unified_frame_argument = UnifiedFrameArgument.objects.get(id=complement_id) + + unified_frame_argument_slowal_frame_mappings = UnifiedFrameArgumentSlowalFrameMapping.objects.filter( + unified_agrument=new_unified_frame_argument) + + for unified_frame_argument_slowal_frame_mapping in unified_frame_argument_slowal_frame_mappings: + if unified_frame_argument_slowal_frame_mapping.slowal_agrument.role.role.role == 'Lemma': + # usuwamy mapowanie bo to tylko lemma + unified_frame_argument_slowal_frame_mapping.delete() + new_unified_frame_argument.delete() unified_frame = UnifiedFrame.objects.get(pk=unified_frame_id) unified_frame.arguments_count = max(0, unified_frame.arguments_count - 1)