janw/tapedrive

View on GitHub
podcasts/views.py

Summary

Maintainability
B
6 hrs
Test Coverage
F
0%

Showing 2 of 2 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

Podcast.objects.prefetch_related("subscribers", "subscribers")
.prefetch_related("followers", "followers")
.annotate(num_episodes=Count("episodes"))
.annotate(downloaded_episodes=Count(Case(When(episodes__downloaded__isnull=False, then=1))))
.annotate(last_episode_date=Max("episodes__published"))
Severity: Major
Found in podcasts/views.py and 1 other location - About 3 hrs to fix
podcasts/views.py on lines 74..78

Similar blocks of code found in 2 locations. Consider refactoring.
Open

self.podcast = get_object_or_404(
(Podcast.objects.prefetch_related("episodes", "episodes").prefetch_related("subscribers", "subscribers"))
.annotate(num_episodes=Count("episodes"))
.annotate(downloaded_episodes=Count(Case(When(episodes__downloaded__isnull=False, then=1))))
.annotate(last_episode_date=Max("episodes__published")),
Severity: Major
Found in podcasts/views.py and 1 other location - About 3 hrs to fix
podcasts/views.py on lines 45..49
Category
Status