diff --git a/scipost_django/organizations/models.py b/scipost_django/organizations/models.py index 08c1edf6fc8ef12af0d4090cbd8d411d118f826c..c60de9b9d08c07680f1e958a774e09c263e3799b 100644 --- a/scipost_django/organizations/models.py +++ b/scipost_django/organizations/models.py @@ -490,17 +490,21 @@ class Organization(models.Model): ] journal_labels = set(jl1 + jl2 + jl3) for journal_label in journal_labels: - sumpf = pfy.filter( + qs = pfy.filter( publication__doi_label__istartswith=journal_label + "." - ).aggregate(Sum("fraction"))["fraction__sum"] + ) + nap = qs.count() + sumpf = qs.aggregate(Sum("fraction"))["fraction__sum"] costperpaper = get_object_or_404( Journal, doi_label=journal_label ).cost_per_publication(year) expenditures = int(costperpaper * sumpf) if sumpf > 0: rep[str(year)]["expenditures"][journal_label] = { - "pubfracs": float(sumpf), "costperpaper": costperpaper, + "nap": nap, + "undivided_expenditures": nap * costperpaper, + "pubfracs": float(sumpf), "expenditures": expenditures, } year_expenditures += expenditures diff --git a/scipost_django/organizations/templates/organizations/_organization_card.html b/scipost_django/organizations/templates/organizations/_organization_card.html index 7c92decfdffbbac6c4df24d7513e440133d1dbbf..303c5adc5a8fec0a7463ae9e9482ba903c949123 100644 --- a/scipost_django/organizations/templates/organizations/_organization_card.html +++ b/scipost_django/organizations/templates/organizations/_organization_card.html @@ -285,10 +285,14 @@ <table class="table table-bordered"> <thead class="table-dark"> <tr> - <th>Journal</th> - <th class="text-end">Sum of PubFracs</th> - <th class="text-end">Cost per publication</th> - <th class="text-end">Expenditures</th> + <th class="align-top">Journal<br></th> + <th class="text-end">SciPost Expenditure<br>per publication</th> + <th class="text-end">NAP<br>for this Org</th> + <th class="text-end"> + Full Expenditures (unshared)<br>by SciPost for these Publications + </th> + <th class="text-end">Sum of PubFracs<br>for this Org</th> + <th class="text-end">Expenditures share<br>for this Org</th> </tr> </thead> <tbody> @@ -296,8 +300,10 @@ {% if journal != 'total' %} <tr> <td>{{ journal }}</td> - <td class="text-end">{{ journaldata.pubfracs }}</td> <td class="text-end">{{ journaldata.costperpaper }}</td> + <td class="text-end">{{ journaldata.nap }}</td> + <td class="text-end">{{ journaldata.undivided_expenditures }}</td> + <td class="text-end">{{ journaldata.pubfracs }}</td> <td class="text-end">{{ journaldata.expenditures }}</td> </tr> {% endif %} diff --git a/scipost_django/organizations/views.py b/scipost_django/organizations/views.py index 48cc36242eb00291c2cb6ee62bbee58290a922eb..75ee133a8e0a31731804a1e2ffe28a36a4d93302 100644 --- a/scipost_django/organizations/views.py +++ b/scipost_django/organizations/views.py @@ -188,7 +188,6 @@ class OrganizationDetailView(DetailView): def get_context_data(self, *args, **kwargs): context = super().get_context_data(*args, **kwargs) context["pubyears"] = range(int(timezone.now().strftime("%Y")), 2015, -1) - # context["balance"] = self.object.get_balance_info() context["balance"] = self.object.cf_balance_info return context