diff --git a/submissions/templatetags/submissions_extras.py b/submissions/templatetags/submissions_extras.py index 7782dcd81080bfde08034e43a2ac861b9d78365f..07250669e53f9a63f5c79394ec557b05b20d9e35 100644 --- a/submissions/templatetags/submissions_extras.py +++ b/submissions/templatetags/submissions_extras.py @@ -39,7 +39,8 @@ def submissions_count_distinct(submissions): def journal_publication_years(journal): years = [] for volume in journal.volume_set.all(): - years.append(volume.until_date.year) + if volume.until_date.year not in years: + years.append(volume.until_date.year) return years @register.filter(name='journal_nr_publications') diff --git a/submissions/views.py b/submissions/views.py index 81851f43f04cf04a0793ce768f7c2a719d191377..82ccebd9df44674a64fac21aff58d9f1b3b57bb2 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -1019,12 +1019,14 @@ def statistics(request, journal_doi_label=None, volume_nr=None, issue_nr=None, y submission_date__year=year, ) context['submissions'] = submissions - if volume_nr: - volume = get_object_or_404(Volume, number=volume_nr) - context['volume'] = volume - if issue_nr: - issue = get_object_or_404(Issue, number=issue_nr) - context['issue'] = issue + if volume_nr: + volume = get_object_or_404(Volume, in_journal=journal, + number=volume_nr) + context['volume'] = volume + if issue_nr: + issue = get_object_or_404(Issue, in_volume=volume, + number=issue_nr) + context['issue'] = issue return render(request, 'submissions/statistics.html', context) @login_required