Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
ValUnifer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IPIPAN
ValUnifer
Commits
d6a73e19
Commit
d6a73e19
authored
1 year ago
by
dcz
Browse files
Options
Downloads
Patches
Plain Diff
Removin user assigment bugfix.
parent
56ab2a38
Branches
Branches containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
semantics/views.py
+7
-6
7 additions, 6 deletions
semantics/views.py
unifier/views.py
+12
-7
12 additions, 7 deletions
unifier/views.py
users/models.py
+3
-2
3 additions, 2 deletions
users/models.py
with
22 additions
and
15 deletions
semantics/views.py
+
7
−
6
View file @
d6a73e19
...
...
@@ -29,7 +29,7 @@ def frame_confirm_invalid(request, frame_pk):
frame
=
get_object_or_404
(
Frame
.
objects
.
filter
(
status
=
choices
.
FrameStatus
.
INVALID
).
select_for_update
(),
pk
=
frame_pk
)
frame
.
status
=
choices
.
FrameStatus
.
BAD
frame
.
save
()
removeSlovalFrameMappingsAndAssigments
(
frame
_pk
)
removeSlovalFrameMappingsAndAssigments
(
frame
)
http
=
urllib3
.
PoolManager
()
r
=
http
.
request
(
'
GET
'
,
settings
.
SLOWAL_FRAME_REMOVE_SERVICE_URL
+
str
(
frame_pk
)
+
...
...
@@ -45,7 +45,7 @@ def frame_reject_invalid(request, frame_pk):
frame
=
get_object_or_404
(
Frame
.
objects
.
filter
(
status
=
choices
.
FrameStatus
.
INVALID
).
select_for_update
(),
pk
=
frame_pk
)
frame
.
status
=
choices
.
FrameStatus
.
NEW
frame
.
save
()
removeSlovalFrameMappingsAndAssigments
(
frame
_pk
)
removeSlovalFrameMappingsAndAssigments
(
frame
)
http
=
urllib3
.
PoolManager
()
r
=
http
.
request
(
'
GET
'
,
settings
.
SLOWAL_FRAME_REMOVE_SERVICE_URL
+
str
(
frame_pk
)
+
...
...
@@ -61,7 +61,7 @@ def frame_mark_as_bad(request, frame_pk):
frame
=
get_object_or_404
(
Frame
.
objects
.
filter
(
status
=
choices
.
FrameStatus
.
NEW
).
select_for_update
(),
pk
=
frame_pk
)
frame
.
status
=
choices
.
FrameStatus
.
BAD
frame
.
save
()
removeSlovalFrameMappingsAndAssigments
(
frame
_pk
)
removeSlovalFrameMappingsAndAssigments
(
frame
)
http
=
urllib3
.
PoolManager
()
r
=
http
.
request
(
'
GET
'
,
settings
.
SLOWAL_FRAME_REMOVE_SERVICE_URL
+
str
(
frame_pk
)
+
...
...
@@ -70,15 +70,16 @@ def frame_mark_as_bad(request, frame_pk):
return
{}
def
removeSlovalFrameMappingsAndAssigments
(
frame
_pk
):
def
removeSlovalFrameMappingsAndAssigments
(
frame
):
#odpianie z ramy zunifikowanej
frame_pk
=
frame
.
pk
unified_frame2_slowal_frame_mappings
=
UnifiedFrame2SlowalFrameMapping
.
objects
.
filter
(
slowal_frame_id
=
frame_pk
)
for
unified_frame2_slowal_frame_mapping
in
unified_frame2_slowal_frame_mappings
:
unified_frame_argument_slowal_frame_mappings
=
UnifiedFrameArgumentSlowalFrameMapping
.
objects
.
filter
(
unified_frame_mapping
=
unified_frame2_slowal_frame_mapping
)
for
unified_frame_argument_slowal_frame_mapping
in
unified_frame_argument_slowal_frame_mappings
:
unified_frame_argument_slowal_frame_mapping
.
delete
()
unified_frame2_slowal_frame_mapping
.
delete
()
Assignment
.
delete
(
subject
_id
=
frame
_pk
)
Assignment
.
delete
(
subject
=
frame
)
@ajax
(
login_required
=
True
,
method
=
'
post
'
)
...
...
@@ -98,7 +99,7 @@ def frame_confirm_as_not_matching_unified_frame(request, frame_pk):
frame
=
get_object_or_404
(
Frame
.
objects
.
select_for_update
(),
pk
=
frame_pk
)
frame
.
status
=
choices
.
FrameStatus
.
NEW
frame
.
save
()
removeSlovalFrameMappingsAndAssigments
(
frame
_pk
)
removeSlovalFrameMappingsAndAssigments
(
frame
)
http
=
urllib3
.
PoolManager
()
r
=
http
.
request
(
'
GET
'
,
settings
.
SLOWAL_FRAME_REMOVE_SERVICE_URL
+
str
(
frame_pk
)
+
...
...
This diff is collapsed.
Click to expand it.
unifier/views.py
+
12
−
7
View file @
d6a73e19
...
...
@@ -257,12 +257,13 @@ def get_unified_frames(request):
res
=
{}
for
unifiedFrame
in
unified_frames
:
user
=
assignment
.
user
.
username
if
(
assignment
:
=
unifiedFrame
.
assignments
.
first
())
else
None
res
[
unifiedFrame
.
id
]
=
{
'
id
'
:
str
(
unifiedFrame
.
id
),
'
title
'
:
unifiedFrame
.
title
,
'
status
'
:
unifiedFrame
.
status
,
'
assignee_username
'
:
assignment
.
user
.
username
if
(
assignment
:
=
unifiedFrame
.
assignments
.
first
())
else
None
,
'
assignee_username
'
:
user
,
'
hierarchy_exists
'
:
unifiedFrame
.
hasHierarchyElems
,
}
...
...
@@ -895,25 +896,29 @@ def frame_assign(request):
return
JsonResponse
({})
def
remove_unified_frame_mappings_and_assigments
(
unified_frame_id
):
def
remove_unified_frame_mappings_and_assigments
(
unified_frame
):
unified_frame_id
=
unified_frame
.
pk
# odpianie z ramy zunifikowanej
unified_frame2_slowal_frame_mappings
=
UnifiedFrame2SlowalFrameMapping
.
objects
.
filter
(
unified_frame_id
=
unified_frame_id
)
for
unifiedFrame2SlowalFrameMapping
in
unified_frame2_slowal_frame_mappings
:
unifiedFrame2SlowalFrameMapping
.
slowal_frame
.
status
=
'
N
'
unifiedFrame2SlowalFrameMapping
.
slowal_frame
.
save
()
Assignment
.
delete
(
subject
_id
=
unifiedFrame2SlowalFrameMapping
.
slowal_frame
.
id
)
Assignment
.
delete
(
subject
=
unifiedFrame2SlowalFrameMapping
.
slowal_frame
)
unified_frame_argument_slowal_frame_mappings
=
UnifiedFrameArgumentSlowalFrameMapping
.
objects
.
filter
(
unified_frame_mapping
=
unifiedFrame2SlowalFrameMapping
)
unified_frame_argument_slowal_frame_mappings
.
delete
()
unifiedFrame2SlowalFrameMapping
.
delete
()
Assignment
.
delete
(
subject
_id
=
unified_frame
_id
)
Assignment
.
delete
(
subject
=
unified_frame
)
@ajax
(
login_required
=
True
,
method
=
'
post
'
)
@transaction.atomic
def
delete_unified_frame
(
request
,
unified_frame_id
):
remove_unified_frame_mappings_and_assigments
(
unified_frame_id
)
unified_frame
=
UnifiedFrame
.
objects
.
get
(
id
=
unified_frame_id
)
remove_unified_frame_mappings_and_assigments
(
unified_frame
)
UnifiedFrameArgument
.
objects
.
filter
(
unified_frame_id
=
unified_frame_id
).
delete
()
slowal_frames
=
UnifiedFrame2SlowalFrameMapping
.
objects
.
filter
(
unified_frame_id
=
unified_frame_id
).
all
()
...
...
@@ -924,7 +929,7 @@ def delete_unified_frame(request, unified_frame_id):
r
=
http
.
request
(
'
GET
'
,
settings
.
SLOWAL_FRAME_REMOVE_SERVICE_URL
+
slowal_frames_ids
+
settings
.
SLOWAL_FRAME_SERVICE_SYSTEM_TYPE_ARG
)
UnifiedFrame
.
objects
.
get
(
id
=
unified_frame
_id
)
.
delete
()
unified_frame
.
delete
()
return
{}
...
...
This diff is collapsed.
Click to expand it.
users/models.py
+
3
−
2
View file @
d6a73e19
...
...
@@ -25,9 +25,10 @@ class Assignment(models.Model):
)
@classmethod
def
delete
(
cls
,
subject
_id
):
def
delete
(
cls
,
subject
):
Assignment
.
objects
.
filter
(
subject_id
=
subject_id
,
subject_ct
=
ContentType
.
objects
.
get_for_model
(
subject
),
subject_id
=
subject
.
pk
,
).
delete
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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