SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
119
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
2e7eaac6
Commit
2e7eaac6
authored
1 month ago
by
George Katsikas
Browse files
Options
Downloads
Patches
Plain Diff
feat:
check that author matched profile duplicates are not fellows
parent
a6d74210
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scipost_django/edadmin/views/preassignment.py
+20
-3
20 additions, 3 deletions
scipost_django/edadmin/views/preassignment.py
scipost_django/profiles/managers.py
+18
-0
18 additions, 0 deletions
scipost_django/profiles/managers.py
with
38 additions
and
3 deletions
scipost_django/edadmin/views/preassignment.py
+
20
−
3
View file @
2e7eaac6
...
...
@@ -2,7 +2,9 @@ __copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
__license__
=
"
AGPL v3
"
from
django.contrib
import
messages
from
django.contrib.auth.decorators
import
login_required
,
user_passes_test
from
django.db.models
import
Q
from
django.http
import
HttpResponse
from
django.shortcuts
import
get_object_or_404
,
render
,
redirect
from
django.urls
import
reverse
...
...
@@ -128,9 +130,24 @@ def _hx_author_profile_action(
)
if
action
==
"
match
"
:
profile
=
get_object_or_404
(
Profile
,
pk
=
profile_id
)
author_profile
.
profile
=
profile
# add Submission's topics to profile:
profile
.
topics
.
add
(
*
submission
.
topics
.
all
())
potential_duplicate_fellow
=
(
Profile
.
objects
.
potential_duplicates_of
(
profile
)
.
annotate
(
is_fellow
=
Q
(
contributor__fellowships__isnull
=
False
))
.
first
()
)
if
potential_duplicate_fellow
:
messages
.
error
(
request
,
"
This profile has potential duplicates which belong to Fellows. Please
"
f
'
<a href=
"
{
reverse
(
"
profiles
:
duplicates
"
, args=(profile.id, potential_duplicate_fellow.id))
}
"
>resolve the duplicates</a>
'
"
before matching.
"
,
)
author_profile
.
profile
=
None
else
:
author_profile
.
profile
=
profile
# add Submission's topics to profile:
profile
.
topics
.
add
(
*
submission
.
topics
.
all
())
elif
action
==
"
unmatch
"
:
author_profile
.
profile
=
None
author_profile
.
save
()
...
...
This diff is collapsed.
Click to expand it.
scipost_django/profiles/managers.py
+
18
−
0
View file @
2e7eaac6
...
...
@@ -89,6 +89,24 @@ class ProfileQuerySet(QuerySet):
|
Q
(
id__in
=
ids_of_duplicates_by_email
)
).
order_by
(
"
last_name
"
,
"
first_name
"
,
"
-id
"
)
def
potential_duplicates_of
(
self
,
profile
:
"
Profile
"
):
"""
Returns only potential duplicate Profiles of the specified Profile.
"""
from
profiles.models
import
ProfileNonDuplicates
profile_non_duplicates
=
ProfileNonDuplicates
.
objects
.
filter
(
id__in
=
profile
.
profilenonduplicates_set
.
values
(
"
id
"
)
).
values_list
(
"
profiles
"
,
flat
=
True
)
qs
=
self
.
filter
(
Q
(
first_name__unaccent__icontains
=
profile
.
first_name
)
&
Q
(
last_name__unaccent__icontains
=
profile
.
last_name
)
|
Q
(
emails__email__in
=
profile
.
emails
.
values
(
"
email
"
))
).
exclude
(
Q
(
id__in
=
profile_non_duplicates
)
|
Q
(
id
=
profile
.
id
))
return
qs
def
specialties_overlap
(
self
,
specialties_slug_list
):
"""
Returns all Profiles whose specialties overlap with those specified in the slug list.
...
...
This diff is collapsed.
Click to expand it.
George Katsikas
@gkatsikas
mentioned in commit
434d6e08
·
1 month ago
mentioned in commit
434d6e08
mentioned in commit 434d6e0804f0fd348edfd010469df80100b7a015
Toggle commit list
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