Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
ValUnifer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IPIPAN
ValUnifer
Commits
0baa931d
Commit
0baa931d
authored
Feb 15, 2024
by
dcz
Browse files
Options
Downloads
Patches
Plain Diff
Modify list of lus bugfix.
parent
a29c551c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
freelus/views.py
+26
-17
26 additions, 17 deletions
freelus/views.py
with
26 additions
and
17 deletions
freelus/views.py
+
26
−
17
View file @
0baa931d
...
...
@@ -47,19 +47,24 @@ def change_lus_in_slowal_frame(request):
frame_id
=
request
.
POST
[
'
frame_id
'
]
lu_ids
=
json
.
loads
(
request
.
POST
[
'
lu_ids
'
])
frame
=
Frame
.
objects
.
get
(
id
=
frame_id
)
frame
.
lexical_units
.
clear
()
frame_lexical_units
=
set
(
map
(
lambda
lu
:
lu
.
id
,
frame
.
lexical_units
.
all
()))
frame_lexical_units_to_remove
=
frame_lexical_units
.
difference
(
set
(
map
(
lambda
lu_id
:
int
(
lu_id
),
lu_ids
)))
entry
=
Entry
.
objects
.
get
(
pk
=
entry_id
)
entry
.
lexical_units
.
clear
()
for
lu_id
in
lu_ids
:
for
lu_id
in
frame_lexical_units_to_remove
:
lu
=
LexicalUnit
.
objects
.
get
(
pk
=
lu_id
)
lu
.
entry
=
entry
lu
.
save
()
frame
.
lexical_units
.
add
(
lu
)
entry
.
lexical_units_count
=
entry
.
lexical_units_count
+
1
entry
.
lexical_units
.
remove
(
lu
)
frame
.
lexical_units
.
remove
(
lu
)
entry
.
lexical_units_count
=
entry
.
lexical_units_count
-
1
if
len
(
frame
.
lexical_units
.
all
())
==
0
:
remove_frame_in_progress
(
frame
,
request
.
user
)
else
:
frame
.
save
()
entry
.
save
()
return
JsonResponse
({})
return
JsonResponse
({})
...
...
@@ -316,8 +321,17 @@ def remove_frame_in_progress(request):
frame_id
=
request
.
POST
[
'
frame_id
'
]
frame
=
Frame
.
objects
.
get
(
id
=
frame_id
)
if
frame
.
in_building
:
remove_frame_in_progress
(
frame
,
request
.
user
)
else
:
return
JsonResponse
({})
return
JsonResponse
({})
return
JsonResponse
({})
Assignment
.
assign
(
user
=
request
.
user
,
subject
=
frame
)
@transaction.atomic
def
remove_frame_in_progress
(
frame
,
user
):
Assignment
.
assign
(
user
=
user
,
subject
=
frame
)
for
argument
in
frame
.
arguments
.
all
():
argument
.
argument_connections
.
all
().
delete
()
# ArgumentConnection.objects.filter(argument=argument).delete()
...
...
@@ -325,11 +339,6 @@ def remove_frame_in_progress(request):
argument
.
delete
()
frame
.
alternation_meanings
.
all
().
delete
()
frame
.
delete
()
else
:
return
JsonResponse
({})
return
JsonResponse
({})
return
JsonResponse
({})
@ajax_required
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment