SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
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
797fe3da
Commit
797fe3da
authored
6 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Compactify code
parent
dda77998
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
profiles/views.py
+3
-2
3 additions, 2 deletions
profiles/views.py
scipost/managers.py
+2
-1
2 additions, 1 deletion
scipost/managers.py
with
5 additions
and
3 deletions
profiles/views.py
+
3
−
2
View file @
797fe3da
...
...
@@ -102,9 +102,10 @@ class ProfileListView(PermissionsMixin, ListView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
().
get_context_data
(
**
kwargs
)
context
[
'
subject_areas
'
]
=
SCIPOST_SUBJECT_AREAS
contributors_dup_email
=
Contributor
.
objects
.
have_duplicate_email
()
context
[
'
nr_contributors_w_duplicate_email
'
]
=
contributors_dup_email
.
count
()
context
[
'
contributors_w_duplicate_email
'
]
=
contributors_dup_email
contributors_wo_profile
=
Contributor
.
objects
.
filter
(
profile
=
None
)
context
[
'
nr_contributors_w_duplicate_email
'
]
=
Contributor
.
objects
.
have_duplicate_email
().
count
()
context
[
'
contributors_w_duplicate_email
'
]
=
Contributor
.
objects
.
have_duplicate_email
()
context
[
'
nr_contributors_wo_profile
'
]
=
contributors_wo_profile
.
count
()
#context['next_contributor_wo_profile'] = random.choice(contributors_wo_profile)
context
[
'
next_contributor_wo_profile
'
]
=
contributors_wo_profile
.
first
()
...
...
This diff is collapsed.
Click to expand it.
scipost/managers.py
+
2
−
1
View file @
797fe3da
...
...
@@ -32,7 +32,8 @@ class ContributorQuerySet(models.QuerySet):
"""
Return Contributors having duplicate emails.
"""
duplicates
=
self
.
values
(
lower_email
=
Lower
(
'
user__email
'
)).
annotate
(
Count
(
'
id
'
)).
order_by
(
'
user__last_name
'
).
filter
(
id__count__gt
=
1
)
return
self
.
annotate
(
lower_email
=
Lower
(
'
user__email
'
)).
filter
(
lower_email__in
=
[
dup
[
'
lower_email
'
]
for
dup
in
duplicates
])
return
self
.
annotate
(
lower_email
=
Lower
(
'
user__email
'
)
).
filter
(
lower_email__in
=
[
dup
[
'
lower_email
'
]
for
dup
in
duplicates
])
def
available
(
self
):
"""
Filter out the Contributors that have active unavailability periods.
"""
...
...
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