SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit e9bc6e6b authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Improve presentation

parent 9b92aaaa
No related branches found
No related tags found
No related merge requests found
......@@ -29,26 +29,38 @@ $(document).ready(function($) {
{% if nr_contributors_w_duplicate_names > 0 %}
<li><a href="{% url 'scipost:contributor_duplicates' %}?kind=names">Handle Contributors with duplicate names ({{ nr_contributors_w_duplicate_names }} to handle)</a></li>
{% else %}
<li class="text-success">[No name-duplicate Contributors found]</li>
<li><i class="fa fa-check-circle text-success"></i> No name-duplicate Contributors found</li>
{% endif %}
{% if nr_contributors_w_duplicate_emails > 0 %}
<li><a href="{% url 'scipost:contributor_duplicates' %}?kind=names">Handle Contributors with duplicate emails ({{ nr_contributors_w_duplicate_emails }} to handle)</a></li>
{% else %}
<li class="text-success">[No email-duplicate Contributors found]</li>
<li><i class="fa fa-check-circle text-success"></i> No email-duplicate Contributors found</li>
{% endif %}
{% if next_contributor_wo_profile %}
<li>Create a Profile for <a href="{% url 'profiles:profile_create' from_type='contributor' pk=next_contributor_wo_profile.id %}">the next</a> Contributor without one ({{ nr_contributors_wo_profile }} to handle)</li>
{% else %}
<li><i class="fa fa-check-circle text-success"></i> All registered Contributors have a Profile</li>
{% endif %}
{% if nr_potential_duplicate_profiles > 0 %}
<li><i class="fa fa-exclamation-circle text-warning"></i> <a href="{% url 'profiles:duplicates' %}">Check for duplicate Profiles ({{ nr_potential_duplicate_profiles }} to handle)</a></li>
{% else %}
<li><i class="fa fa-check-circle text-success"></i> No potential duplicate Profiles detected</li>
{% endif %}
{% if next_reginv_wo_profile %}
<li><i class="fa fa-exclamation-circle text-warning"></i> Create a Profile for <a href="{% url 'profiles:profile_create' from_type='registrationinvitation' pk=next_reginv_wo_profile.id %}">the next</a> Registration Invitation without one ({{ nr_reginv_wo_profile }} to handle)</li>
{% else %}
<li><i class="fa fa-check-circle text-success"></i> All Registration Invitations have a Profile</li>
{% endif %}
{% if next_unreg_auth_wo_profile %}
<li><i class="fa fa-exclamation-circle text-warning"></i> Create a Profile for <a href="{% url 'profiles:profile_create' from_type='unregisteredauthor' pk=next_unreg_auth_wo_profile.id %}">the next</a> UnregisteredAuthor without one ({{ nr_unreg_auth_wo_profile }} to handle)</li>
{% else %}
<li><i class="fa fa-check-circle text-success"></i> All UnregisteredAuthors have a Profile</li>
{% endif %}
{% if next_refinv_wo_profile %}
<li><i class="fa fa-exclamation-circle text-warning"></i> Create a Profile for <a href="{% url 'profiles:profile_create' from_type='refereeinvitation' pk=next_refinv_wo_profile.id %}">the next</a> Referee Invitation without one ({{ nr_refinv_wo_profile }} to handle)</li>
{% else %}
<li><i class="fa fa-check-circle text-success"></i> All Referee Invitations have a Profile</li>
{% endif %}
<li><a href="{% url 'profiles:duplicates' %}">Check for duplicate Profiles ({{ nr_potential_duplicate_profiles }} to handle)</a></li>
{% if next_reginv_wo_profile %}
<li>Create a Profile for <a href="{% url 'profiles:profile_create' from_type='registrationinvitation' pk=next_reginv_wo_profile.id %}">the next</a> Registration Invitation without one ({{ nr_reginv_wo_profile }} to handle)</li>
{% endif %}
{% if next_unreg_auth_wo_profile %}
<li>Create a Profile for <a href="{% url 'profiles:profile_create' from_type='unregisteredauthor' pk=next_unreg_auth_wo_profile.id %}">the next</a> UnregisteredAuthor without one ({{ nr_unreg_auth_wo_profile }} to handle)</li>
{% endif %}
{% if next_refinv_wo_profile %}
<li>Create a Profile for <a href="{% url 'profiles:profile_create' from_type='refereeinvitation' pk=next_refinv_wo_profile.id %}">the next</a> Referee Invitation without one ({{ nr_refinv_wo_profile }} to handle)</li>
{% endif %}
<li><a href="{% url 'profiles:profile_create' %}">Add a Profile</a></li>
</ul>
<h4>Specialize the list:</h4>
......
......@@ -70,7 +70,8 @@ class ProfileCreateView(PermissionsMixin, CreateView):
matching_profiles = matching_profiles.filter(
Q(last_name=reginv.last_name) |
Q(emails__email__in=reginv.email))
context['matching_profiles'] = matching_profiles.distinct()
context['matching_profiles'] = matching_profiles.distinct().order_by(
'last_name', 'first_name')
return context
def get_initial(self):
......@@ -137,6 +138,12 @@ def profile_match(request, profile_id, from_type, pk):
nr_rows = 0
if from_type == 'contributor':
nr_rows = Contributor.objects.filter(pk=pk).update(profile=profile)
# Give priority to the email coming from Contributor
if nr_rows == 1:
profile.emails.update(primary=False)
email, __ = ProfileEmail.objects.get_or_create(
profile=profile, email=get_object_or_404(Contributor, pk=pk).user.email)
profile.emails.filter(id=email.id).update(primary=True, still_valid=True)
elif from_type == 'unregisteredauthor':
nr_rows = UnregisteredAuthor.objects.filter(pk=pk).update(profile=profile)
elif from_type == 'refereeinvitation':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment