diff --git a/scipost_django/api/urls.py b/scipost_django/api/urls.py index 96f31b84cb154a7ceb73b2c7ce035842f243b6bd..98c46e8b50377c9fe8859cd285d74933d7ee16c7 100644 --- a/scipost_django/api/urls.py +++ b/scipost_django/api/urls.py @@ -14,7 +14,7 @@ from colleges.api.viewsets import FellowshipPublicAPIViewSet from journals.api.viewsets import ( PublicationPublicAPIViewSet, PublicationPublicSearchAPIViewSet, - PubFractionPublicAPIViewSet, + PubFracPublicAPIViewSet, ) # submissions @@ -61,7 +61,7 @@ router.register("colleges/fellowships", FellowshipPublicAPIViewSet) # journals router.register("publications", PublicationPublicAPIViewSet) -router.register("pubfractions", PubFractionPublicAPIViewSet) +router.register("pubfracs", PubFracPublicAPIViewSet) # submissions router.register("submissions", SubmissionPublicAPIViewSet) diff --git a/scipost_django/finances/templates/finances/business_model.html b/scipost_django/finances/templates/finances/business_model.html index 200328242ba63ae06a757458ffa28e10b796b332..f6c8d0749e29695bdf0fe0cd65e5ab5a22042a3c 100644 --- a/scipost_django/finances/templates/finances/business_model.html +++ b/scipost_django/finances/templates/finances/business_model.html @@ -49,7 +49,7 @@ <ul> <li><a href="#finances">The Finances Pages</a></li> <li><a href="#organizations">The Organizations Pages</a></li> - <li><a href="#pubFractions">The PubFractions System</a></li> + <li><a href="#pubFracs">The PubFracs System</a></li> <li><a href="#sponsorshipLevels">Sponsorship Levels</a></li> <li><a href="#inKind">In-kind Support</a></li> </ul> @@ -91,10 +91,10 @@ <a href="{% url 'organizations:organizations' %}" target="_blank">Organizations pages</a> in the form of each Organization's NAP (Number of Associated Publications). </li> <li> - <strong>Determining PubFractions</strong><br> - After publication, PubFractions are specified - (a publication's set of PubFractions answers the question "what was each supporting Organization's share of the support for the research leading to this publication?"; - see the <a href="#pubFractions">PubFractions system description</a> below). + <strong>Determining PubFracs</strong><br> + After publication, PubFracs are specified + (a publication's set of PubFracs answers the question "what was each supporting Organization's share of the support for the research leading to this publication?"; + see the <a href="#pubFracs">PubFracs system description</a> below). </li> <li> <strong>Determination of operational costs</strong><br> @@ -111,7 +111,7 @@ <li> <strong>Sponsorship</strong><br> Organizations can inspect all the data (in particular their NAPs and summed-up - PubFractions, together with the free-riding fraction) + PubFracs, together with the free-riding fraction) and hereby determine to which level they choose to support SciPost (through a sponsorship agreement). Sponsors can fall into different @@ -179,7 +179,7 @@ </div> </div> - <h3 class="highlight" id="pubFractions">The PubFractions System</h3> + <h3 class="highlight" id="pubFracs">The PubFracs System</h3> <div class="m-2"> <div class="row"> <div class="col-lg-6"> @@ -192,7 +192,7 @@ </p> <p> In order to resolve things more finely, we run an internal system - based on the idea of <strong>PubFractions</strong>, in which + based on the idea of <strong>PubFracs</strong>, in which each paper has one unit of support recognition to be distributed among the Organizations having supported the research detailed in that paper. This is not meant to be <em>extremely</em> accurate, but should still @@ -202,10 +202,10 @@ The weight is given by the following simple algorithm: first, the unit is split equally among each of the authors. Then, for each author, their share is split equally among their affiliations. - Any given paper's pubfractions sum up to $1$. + Any given paper's PubFracs sum up to $1$. This information is filled by our editorial administration at the moment of publication. - These pubfractions are then automatically compiled and linked to the relevant + These PubFracs are then automatically compiled and linked to the relevant Organizations. This data is displayed on our Organization detail pages. </p> </div> @@ -258,11 +258,11 @@ <strong>Bronze</strong>: sponsorship level $\gt 0$; </li> <li> - <strong>Silver</strong>: sponsorship level $\geq$ (own PubFractions) + <strong>Silver</strong>: sponsorship level $\geq$ (own PubFracs) $\times$ average cost per publication; </li> <li> - <strong>Gold</strong>: sponsorship level $\geq$ (own PubFractions) $\times$ + <strong>Gold</strong>: sponsorship level $\geq$ (own PubFracs) $\times$ average cost per publication $/$ (1 - free-riding fraction); </li> <li> @@ -358,7 +358,7 @@ </ul> </p> <p> - Our consortial funding model with pubfractions-based recognition + Our consortial funding model with PubFracs-based recognition solves all these problems in one go. Our pooling of resources and maximally simple accounting drastically simplifies administration for everybody involved. Our transparency means that recognition is given where diff --git a/scipost_django/journals/api/filtersets/__init__.py b/scipost_django/journals/api/filtersets/__init__.py index 4076babe7d0e0c4e953c14f8e5a74d8ad163f6c4..a4d0af83f6b527691fee1f5d5fc8e1fef56c8df5 100644 --- a/scipost_django/journals/api/filtersets/__init__.py +++ b/scipost_django/journals/api/filtersets/__init__.py @@ -7,4 +7,4 @@ from .publication import ( PublicationPublicSearchAPIFilterSet, ) -from .pubfraction import PubFractionPublicAPIFilterSet +from .pubfrac import PubFracPublicAPIFilterSet diff --git a/scipost_django/journals/api/filtersets/pubfraction.py b/scipost_django/journals/api/filtersets/pubfrac.py similarity index 92% rename from scipost_django/journals/api/filtersets/pubfraction.py rename to scipost_django/journals/api/filtersets/pubfrac.py index cbfe1d38ce42ae97b8fd82456f0c61c32d0fb8f9..220934998541b01d8a24a585e3cb092c4da2e69a 100644 --- a/scipost_django/journals/api/filtersets/pubfraction.py +++ b/scipost_django/journals/api/filtersets/pubfrac.py @@ -7,7 +7,7 @@ from django_filters import rest_framework as df_filters from finances.models import PubFrac -class PubFractionPublicAPIFilterSet(df_filters.FilterSet): +class PubFracPublicAPIFilterSet(df_filters.FilterSet): class Meta: model = PubFrac fields = { diff --git a/scipost_django/journals/api/serializers/__init__.py b/scipost_django/journals/api/serializers/__init__.py index b564fb91b86cf50b362554f59538bc07bd2c77d6..010c174121505ebc8b0d05b29575d63f8d0db71c 100644 --- a/scipost_django/journals/api/serializers/__init__.py +++ b/scipost_django/journals/api/serializers/__init__.py @@ -7,4 +7,4 @@ from .publication import ( PublicationPublicSearchSerializer, ) -from .pubfraction import PubFractionPublicSerializer +from .pubfrac import PubFracPublicSerializer diff --git a/scipost_django/journals/api/serializers/pubfraction.py b/scipost_django/journals/api/serializers/pubfrac.py similarity index 91% rename from scipost_django/journals/api/serializers/pubfraction.py rename to scipost_django/journals/api/serializers/pubfrac.py index c0294c0792b6dd6ca9646ae291edb15f29a26f75..764f43722aa149fd596012f82caa3084bde7c904 100644 --- a/scipost_django/journals/api/serializers/pubfraction.py +++ b/scipost_django/journals/api/serializers/pubfrac.py @@ -9,7 +9,7 @@ from journals.api.serializers import PublicationPublicSearchSerializer from organizations.api.serializers import OrganizationPublicSerializer -class PubFractionPublicSerializer(serializers.ModelSerializer): +class PubFracPublicSerializer(serializers.ModelSerializer): organization = OrganizationPublicSerializer( fields=["url", "name", "acronym", "country"] ) diff --git a/scipost_django/journals/api/viewsets/__init__.py b/scipost_django/journals/api/viewsets/__init__.py index e7344e94a68969446a27740e883702d8f4d48aad..cd1d727c8578a1b13590ab89681b4990dd636d39 100644 --- a/scipost_django/journals/api/viewsets/__init__.py +++ b/scipost_django/journals/api/viewsets/__init__.py @@ -7,4 +7,4 @@ from .publication import ( PublicationPublicSearchAPIViewSet, ) -from .pubfraction import PubFractionPublicAPIViewSet +from .pubfrac import PubFracPublicAPIViewSet diff --git a/scipost_django/journals/api/viewsets/pubfraction.py b/scipost_django/journals/api/viewsets/pubfrac.py similarity index 77% rename from scipost_django/journals/api/viewsets/pubfraction.py rename to scipost_django/journals/api/viewsets/pubfrac.py index 9c9f6017d1cb45cb043289751382c68c43535911..7508d98284b06699e40045735ac31a54196f9012 100644 --- a/scipost_django/journals/api/viewsets/pubfraction.py +++ b/scipost_django/journals/api/viewsets/pubfrac.py @@ -12,25 +12,25 @@ from rest_framework_csv import renderers as r from api.viewsets.mixins import FilteringOptionsActionMixin from finances.models import PubFrac -from journals.api.serializers import PubFractionPublicSerializer +from journals.api.serializers import PubFracPublicSerializer -from journals.api.filtersets import PubFractionPublicAPIFilterSet +from journals.api.filtersets import PubFracPublicAPIFilterSet -class PubFractionPublicAPIViewSet( +class PubFracPublicAPIViewSet( FilteringOptionsActionMixin, viewsets.ReadOnlyModelViewSet ): queryset = PubFrac.objects.all() permission_classes = [ AllowAny, ] - serializer_class = PubFractionPublicSerializer + serializer_class = PubFracPublicSerializer renderer_classes = tuple(api_settings.DEFAULT_RENDERER_CLASSES) + (r.CSVRenderer,) search_fields = ["organization__name", "publication__publication_date__year"] ordering_fields = [ "-publication_date", ] - filterset_class = PubFractionPublicAPIFilterSet + filterset_class = PubFracPublicAPIFilterSet default_filtering_fields = [ "organization__name__icontains", "publication__publication_date__year__exact", diff --git a/scipost_django/journals/forms.py b/scipost_django/journals/forms.py index 683fc8422a1cd3ca6f31ae32310c1661da16273f..3b38810ffaf0dc1c857fcbc3bf305610f1e898bd 100644 --- a/scipost_django/journals/forms.py +++ b/scipost_django/journals/forms.py @@ -799,8 +799,8 @@ class DraftAccompanyingPublicationForm(forms.Form): link=reference.link, ) - # Add PubFractions - for pubfrac in anchor.pubfractions.all(): + # Add PubFracs + for pubfrac in anchor.pubfracs.all(): PubFrac.objects.create( organization=pubfrac.organization, publication=companion, diff --git a/scipost_django/journals/migrations/0130_remove_publication_pubfractions_confirmed_by_authors.py b/scipost_django/journals/migrations/0130_remove_publication_pubfractions_confirmed_by_authors.py new file mode 100644 index 0000000000000000000000000000000000000000..5861b462b5308614c50e36e153ec31921bb6c965 --- /dev/null +++ b/scipost_django/journals/migrations/0130_remove_publication_pubfractions_confirmed_by_authors.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.10 on 2024-03-14 19:33 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("journals", "0129_alter_issue_in_journal_alter_issue_in_volume_and_more"), + ] + + operations = [ + migrations.RemoveField( + model_name="publication", + name="pubfractions_confirmed_by_authors", + ), + ] diff --git a/scipost_django/journals/models/publication.py b/scipost_django/journals/models/publication.py index 83a5bc34a9d104ef636fa75ee43b0b094aa5e01e..c608d59515db6eb2ecdc2d1c959b89ecc278aeb7 100644 --- a/scipost_django/journals/models/publication.py +++ b/scipost_django/journals/models/publication.py @@ -157,7 +157,6 @@ class Publication(models.Model): funders_generic = models.ManyToManyField( "funders.Funder", blank=True ) # not linked to a grant - pubfractions_confirmed_by_authors = models.BooleanField(default=False) # Metadata metadata = models.JSONField(default=dict, blank=True, null=True) @@ -421,9 +420,9 @@ class Publication(models.Model): ) @property - def pubfractions_sum_to_1(self): + def pubfracs_sum_to_1(self): """Checks that the support fractions sum up to one.""" - return self.pubfractions.aggregate(Sum("fraction"))["fraction__sum"] == 1 + return self.pubfracs.aggregate(Sum("fraction"))["fraction__sum"] == 1 @property def citation(self): diff --git a/scipost_django/journals/templates/journals/_publication_actions.html b/scipost_django/journals/templates/journals/_publication_actions.html index 43613a0b14b08443cac5697c729c8cd2af2cfdbb..ff41a03b5eb8224d9d3db4d219e459c4d108b11b 100644 --- a/scipost_django/journals/templates/journals/_publication_actions.html +++ b/scipost_django/journals/templates/journals/_publication_actions.html @@ -75,7 +75,7 @@ <a href="{% url 'journals:manage_publication_resources' publication.doi_label %}">Manage publication resources</a> </li> <li> - <a href="{% url 'journals:allocate_orgpubfractions' publication.doi_label %}">Allocate Org Pub Fractions</a> + <a href="{% url 'journals:allocate_pubfracs' publication.doi_label %}">Allocate PubFracs</a> </li> {% comment %} <li> <a href="{% url 'journals:update_references' doi_label=publication.doi_label %}">Update references</a> diff --git a/scipost_django/journals/templates/journals/allocate_orgpubfractions.html b/scipost_django/journals/templates/journals/allocate_pubfracs.html similarity index 85% rename from scipost_django/journals/templates/journals/allocate_orgpubfractions.html rename to scipost_django/journals/templates/journals/allocate_pubfracs.html index ca421f2f1d630a1f488edb95686483de84596c4a..945e3aa9b08d77086c670243d0ff8e9aa77c3676 100644 --- a/scipost_django/journals/templates/journals/allocate_orgpubfractions.html +++ b/scipost_django/journals/templates/journals/allocate_pubfracs.html @@ -1,6 +1,6 @@ {% extends 'scipost/base.html' %} -{% block pagetitle %}: Allocate support fractions{% endblock pagetitle %} +{% block pagetitle %}: Allocate Publication Fractions{% endblock pagetitle %} {% block breadcrumb %} <div class="breadcrumb-container"> @@ -8,7 +8,7 @@ <nav class="breadcrumb hidden-sm-down"> <a href="{% url 'journals:journals' %}" class="breadcrumb-item">Journals</a> <a href="{% url 'journals:manage_metadata' %}" class="breadcrumb-item">Administration</a> - <span class="breadcrumb-item active">Allocate support fractions</span> + <span class="breadcrumb-item active">Allocate Publication Fractions</span> </nav> </div> </div> @@ -29,10 +29,10 @@ <p>Please indicate <strong>which Organizations should be credited with supporting the research published in this publication</strong>.<br/>Data provided here is indicative and does not need to be extremely accurate.<br/>Note however that this data <strong>is used</strong> to set the suggested level of support from external Organizations which SciPost needs to remain sustainable.<br/><br/>The Organizations listed here appear as either host institutions for the authors, or as acknowledged funders.</p> - <p><a class="btn btn-primary" href="{% url 'journals:preallocate_orgpubfractions_from_affiliations' doi_label=publication.doi_label %}">Preallocate fractions based on author affiliations</a></p> + <p><a class="btn btn-primary" href="{% url 'journals:preallocate_pubfracs_from_affiliations' doi_label=publication.doi_label %}">Preallocate fractions based on author affiliations</a></p> - <form method="post" action="{% url 'journals:allocate_orgpubfractions' doi_label=publication.doi_label %}"> + <form method="post" action="{% url 'journals:allocate_pubfracs' doi_label=publication.doi_label %}"> {% csrf_token %} {{ formset.management_form }} <table class="table"> diff --git a/scipost_django/journals/templatetags/journals_extras.py b/scipost_django/journals/templatetags/journals_extras.py index 1981386939f92c8ce27bb883413753b82d58dfae..ab4fb670462a2578c38edd0332518e0f98364acc 100644 --- a/scipost_django/journals/templatetags/journals_extras.py +++ b/scipost_django/journals/templatetags/journals_extras.py @@ -83,10 +83,7 @@ def latest_successful_crossref_generic_deposit(_object): @register.filter(name="pubfracs_fixed") def pubfracs_fixed(publication): - return ( - publication.pubfractions_confirmed_by_authors - and publication.pubfractions_sum_to_1 - ) + return publication.pubfracs_sum_to_1 @register.simple_tag(takes_context=True) diff --git a/scipost_django/journals/urls/general.py b/scipost_django/journals/urls/general.py index 11b930d1b8a4779cd027a906dc6af4e16b810409..38f0f8de6e98e149ef020d112801f21411634092 100644 --- a/scipost_django/journals/urls/general.py +++ b/scipost_django/journals/urls/general.py @@ -281,16 +281,16 @@ urlpatterns = [ journals_views.publication_remove_topic, name="publication_remove_topic", ), - # PubFraction allocation: + # PubFrac allocation: path( - "allocate_orgpubfractions/<publication_doi_label:doi_label>", - journals_views.allocate_orgpubfractions, - name="allocate_orgpubfractions", + "allocate_pubfracs/<publication_doi_label:doi_label>", + journals_views.allocate_pubfracs, + name="allocate_pubfracs", ), path( - "preallocate_orgpubfractions_from_affiliations/<publication_doi_label:doi_label>", - journals_views.preallocate_orgpubfractions_from_affiliations, - name="preallocate_orgpubfractions_from_affiliations", + "preallocate_pubfracs_from_affiliations/<publication_doi_label:doi_label>", + journals_views.preallocate_pubfracs_from_affiliations, + name="preallocate_pubfracs_from_affiliations", ), # Citedby path( diff --git a/scipost_django/journals/views.py b/scipost_django/journals/views.py index c6e3966599942477e1652ed783c49a2801a52605..799a3fb2c19f250df065eab21f82964ae54bc42a 100644 --- a/scipost_django/journals/views.py +++ b/scipost_django/journals/views.py @@ -1369,7 +1369,7 @@ def publication_remove_topic(request, doi_label, slug): @login_required @permission_required("scipost.can_publish_accepted_submission", return_403=True) -def allocate_orgpubfractions(request, doi_label): +def allocate_pubfracs(request, doi_label): """ Set the relative support obtained from Organizations for the research contained in a Publication. @@ -1383,7 +1383,7 @@ def allocate_orgpubfractions(request, doi_label): publication=publication, organization=org ) formset = PubFracsFormSet( - request.POST or None, queryset=publication.pubfractions.all() + request.POST or None, queryset=publication.pubfracs.all() ) if formset.is_valid(): formset.save() @@ -1393,14 +1393,14 @@ def allocate_orgpubfractions(request, doi_label): "publication": publication, "formset": formset, } - return render(request, "journals/allocate_orgpubfractions.html", context) + return render(request, "journals/allocate_pubfracs.html", context) @login_required @permission_required("scipost.can_publish_accepted_submission", return_403=True) -def preallocate_orgpubfractions_from_affiliations(request, doi_label): +def preallocate_pubfracs_from_affiliations(request, doi_label): """ - Prefill the pubfractions based on the author affiliations. + Prefill the pubfracs based on the author affiliations. """ publication = get_object_or_404(Publication, doi_label=doi_label) nr_authors = publication.authors.all().count() @@ -1420,7 +1420,7 @@ def preallocate_orgpubfractions_from_affiliations(request, doi_label): ).update(fraction=Decimal(fraction[org.id])) return redirect( reverse( - "journals:allocate_orgpubfractions", + "journals:allocate_pubfracs", kwargs={"doi_label": doi_label}, ) ) diff --git a/scipost_django/organizations/api/viewsets/organization.py b/scipost_django/organizations/api/viewsets/organization.py index b788c5918bb5daa8cc632ea2af810ccfb0af9730..0073fa08babc5c956a855d9be11ac99f80f5c783 100644 --- a/scipost_django/organizations/api/viewsets/organization.py +++ b/scipost_django/organizations/api/viewsets/organization.py @@ -13,7 +13,7 @@ from rest_framework_csv import renderers as r from api.viewsets.mixins import FilteringOptionsActionMixin -from journals.api.serializers import PubFractionPublicSerializer +from journals.api.serializers import PubFracPublicSerializer from organizations.models import Organization from organizations.api.filtersets import OrganizationPublicAPIFilterSet from organizations.api.serializers import ( @@ -47,10 +47,10 @@ class OrganizationPublicAPIViewSet( ] @action(detail=True) - def pubfractions(self, request, pk=None): - pubfractions = self.get_object().pubfractions.all() - serializer = PubFractionPublicSerializer( - pubfractions, many=True, context={"request": self.request} + def pubfracs(self, request, pk=None): + pubfracs = self.get_object().pubfracs.all() + serializer = PubFracPublicSerializer( + pubfracs, many=True, context={"request": self.request} ) return Response(serializer.data) diff --git a/scipost_django/organizations/models.py b/scipost_django/organizations/models.py index 6a4bdeefb5d717e68d9bd62076025fec68d47698..08c1edf6fc8ef12af0d4090cbd8d411d118f826c 100644 --- a/scipost_django/organizations/models.py +++ b/scipost_django/organizations/models.py @@ -209,7 +209,7 @@ class Organization(models.Model): def get_affiliate_publications(self, journal): return AffiliatePublication.objects.filter( - pubfractions__organization=self, + pubfracs__organization=self, journal=journal, ) @@ -320,9 +320,9 @@ class Organization(models.Model): self.cf_balance_info = self.get_balance_info() self.save() - def pubfraction_for_publication(self, doi_label): + def pubfrac_for_publication(self, doi_label): """ - Return the organization's pubfraction for a publication. + Return the organization's pubfrac for a publication. """ pfs = PubFrac.objects.filter(publication__doi_label=doi_label) try: @@ -335,8 +335,8 @@ class Organization(models.Model): if children_contribs is not None: message = "as parent (ascribed to " for child in self.children.all(): - pfc = child.pubfraction_for_publication(doi_label) - if pfc not in ["No PubFraction ascribed", "Not yet defined"]: + pfc = child.pubfrac_for_publication(doi_label) + if pfc not in ["No PubFrac ascribed", "Not yet defined"]: message += "%s: %s; " % (child, pfc) return message.rpartition(";")[0] + ")" return "Not yet defined" @@ -383,20 +383,14 @@ class Organization(models.Model): "message": message, } - def pubfractions_in_year(self, year): + def pubfracs_in_year(self, year): """ - Returns the sum of pubfractions for the given year. + Returns the sum of pubfracs for the given year. """ fractions = PubFrac.objects.filter( organization=self, publication__publication_date__year=year ) return { - "confirmed": fractions.filter( - publication__pubfractions_confirmed_by_authors=True - ).aggregate(Sum("fraction"))["fraction__sum"], - "estimated": fractions.filter( - publication__pubfractions_confirmed_by_authors=False - ).aggregate(Sum("fraction"))["fraction__sum"], "total": fractions.aggregate(Sum("fraction"))["fraction__sum"], } @@ -462,7 +456,7 @@ class Organization(models.Model): cumulative_balance = 0 cumulative_expenditures = 0 cumulative_contribution = 0 - pf = self.pubfractions.all() + pf = self.pubfracs.all() for year in pubyears: rep[str(year)] = {} contribution = self.total_subsidies_in_year(year) @@ -505,7 +499,7 @@ class Organization(models.Model): expenditures = int(costperpaper * sumpf) if sumpf > 0: rep[str(year)]["expenditures"][journal_label] = { - "pubfractions": float(sumpf), + "pubfracs": float(sumpf), "costperpaper": costperpaper, "expenditures": expenditures, } diff --git a/scipost_django/organizations/templates/organizations/_organization_card.html b/scipost_django/organizations/templates/organizations/_organization_card.html index beeb561c2120dddef6b76b383af3bfe6e799c843..7c92decfdffbbac6c4df24d7513e440133d1dbbf 100644 --- a/scipost_django/organizations/templates/organizations/_organization_card.html +++ b/scipost_django/organizations/templates/organizations/_organization_card.html @@ -17,7 +17,7 @@ <a class="nav-link" id="details-{{ org.id }}-tab" data-bs-toggle="tab" href="#details-{{ org.id }}" role="tab" aria-controls="details-{{ org.id }}" aria-selected="true">Details</a> </li> <li class="nav-item"> - <a class="nav-link active" id="publications-{{ org.id }}-tab" data-bs-toggle="tab" href="#publications-{{ org.id }}" role="tab" aria-controls="publications-{{ org.id }}" aria-selected="true">Publications{% if perms.scipost.can_manage_organizations %} & PubFractions{% endif %}</a> + <a class="nav-link active" id="publications-{{ org.id }}-tab" data-bs-toggle="tab" href="#publications-{{ org.id }}" role="tab" aria-controls="publications-{{ org.id }}" aria-selected="true">Publications{% if perms.scipost.can_manage_organizations %} & PubFracs{% endif %}</a> </li> <li class="nav-item"> <a class="nav-link" id="authors-{{ org.id }}-tab" data-bs-toggle="tab" href="#authors-{{ org.id }}" role="tab" aria-controls="authors-{{ org.id }}" aria-selected="true">Associated Authors</a> @@ -75,9 +75,9 @@ <div class="tab-pane show active pt-4" id="publications-{{ org.id }}" role="tabpanel" aria-labelledby="publications-{{ org.id }}-tab"> <h3>Publications associated to this Organization {% if perms.scipost.can_manage_organizations %} - <span class="text-muted small">(with PubFractions <span data-bs-toggle="tooltip" data-bs-html="true" title="" data-original-title="Fraction of a publication's funding/institutional support associated to a given Organization">{% include 'bi/info-circle-fill.html' %}</span>)</span>{% endif %}:</h3> + <span class="text-muted small">(with PubFracs <span data-bs-toggle="tooltip" data-bs-html="true" title="" data-original-title="Fraction of a publication's funding/institutional support associated to a given Organization">{% include 'bi/info-circle-fill.html' %}</span>)</span>{% endif %}:</h3> {% for pubyear in pubyears %} - <h4>{{ pubyear }}{% if perms.scipost.can_manage_organizations %} <span class="text-muted small">(PubFractions {{ org|pubfractions_in_year:pubyear }})</span>{% endif %}</h4> + <h4>{{ pubyear }}{% if perms.scipost.can_manage_organizations %} <span class="text-muted small">(PubFracs {{ org|pubfracs_in_year:pubyear }})</span>{% endif %}</h4> <ul> {% for publication in org.get_publications %} {% if publication.publication_date|date:'Y'|add:"0" == pubyear %} @@ -286,7 +286,7 @@ <thead class="table-dark"> <tr> <th>Journal</th> - <th class="text-end">Sum of PubFractions</th> + <th class="text-end">Sum of PubFracs</th> <th class="text-end">Cost per publication</th> <th class="text-end">Expenditures</th> </tr> @@ -296,7 +296,7 @@ {% if journal != 'total' %} <tr> <td>{{ journal }}</td> - <td class="text-end">{{ journaldata.pubfractions }}</td> + <td class="text-end">{{ journaldata.pubfracs }}</td> <td class="text-end">{{ journaldata.costperpaper }}</td> <td class="text-end">{{ journaldata.expenditures }}</td> </tr> @@ -304,7 +304,7 @@ {% endfor %} </tbody> </table> - <p>You can see the associated publications and their PubFractions under the <em>Publications & PubFractions</em> tab.</p> + <p>You can see the associated publications and their PubFracs under the <em>Publications & PubFracs</em> tab.</p> </div> </td> </tr> diff --git a/scipost_django/organizations/templatetags/organizations_extras.py b/scipost_django/organizations/templatetags/organizations_extras.py index 2ae7bb56ab8a0a545217cd550ada5c2c02673c4b..58bb01857377cb364b2cff8e4592ddf919ab6f0a 100644 --- a/scipost_django/organizations/templatetags/organizations_extras.py +++ b/scipost_django/organizations/templatetags/organizations_extras.py @@ -7,9 +7,9 @@ from django import template register = template.Library() -@register.filter(name="pubfraction_for_publication") -def pubfraction_for_publication(org, publication): - return org.pubfraction_for_publication(publication.doi_label) +@register.filter(name="pubfrac_for_publication") +def pubfrac_for_publication(org, publication): + return org.pubfrac_for_publication(publication.doi_label) @register.filter(name="expenditure_for_publication") @@ -18,20 +18,10 @@ def expenditure_for_publication(org, publication): return org.cf_expenditure_for_publication[publication.doi_label]["expenditure"] -@register.filter(name="pubfractions_in_year") -def pubfractions_in_year(org, year): - fractions = org.pubfractions_in_year(int(year)) +@register.filter(name="pubfracs_in_year") +def pubfracs_in_year(org, year): + fractions = org.pubfracs_in_year(int(year)) if not fractions["total"]: return "total: 0" text = "total: %s" % fractions["total"] - if fractions["confirmed"] == fractions["total"]: - text += " (confirmed)" - return text - elif fractions["estimated"] == fractions["total"]: - text += " (estimated)" - return text - text += " (confirmed: %s; estimated: %s)" % ( - fractions["confirmed"], - fractions["estimated"], - ) return text diff --git a/scipost_django/organizations/views.py b/scipost_django/organizations/views.py index 3b55b714545effc5817aea2b2c25f8f710340c4c..48cc36242eb00291c2cb6ee62bbee58290a922eb 100644 --- a/scipost_django/organizations/views.py +++ b/scipost_django/organizations/views.py @@ -207,7 +207,7 @@ class OrganizationDetailView(DetailView): "contactrole_set", "funder_set", "organizationevent_set", - "pubfractions", + "pubfracs", )