# Path: apps/broadcasts/views.py
# class BroadcastDetailView(DetailView):
#     model = Broadcast
#     slug_field = 'number'
# 
# class BroadcastListView(ListView):
#     model = Broadcast
# 
#     def calculate_highlights_per_episode(self, **kwargs):
#         episodes = Broadcast.objects.count()
#         highlights = Highlight.objects.count()
#         return round((highlights / episodes), 2)
# 
#     def calculate_raids_per_episode(self, **kwargs):
#         # Subtract 50 from the total number of episodes, since we only started
#         # recording raids at episode 51.
#         episodes = Broadcast.objects.count() - 50
#         raids = Raid.objects.count()
#         return round((raids / episodes), 2)
# 
#     def get_context_data(self, **kwargs):
#         context = super().get_context_data(**kwargs)
#         context['first'] = Broadcast.objects.earliest()
#         context['games'] = Game.objects.all()
#         context['games_completed'] = Game.objects.filter(is_completed=True)
# 
#         # Highlights.
#         context['highlights'] = Highlight.objects.all()
#         context['highlights_per_episode'] = self.calculate_highlights_per_episode()
# 
#         # Raids.
#         context['raids'] = Raid.objects.all()
#         context['raids_per_episode'] = self.calculate_raids_per_episode()
#         return context


from django.conf.urls import url
from .views import BroadcastDetailView, BroadcastListView
# -*- coding: utf-8 -*-



urlpatterns = [
    url(r'^episode/(?P<slug>[-\w]+)/$', name='broadcast-detail', view=BroadcastDetailView.as_view()),
    url(r'^broadcasts/$', name='broadcast-list', view=BroadcastListView.as_view()),

# Path: apps/broadcasts/views.py
# class BroadcastDetailView(DetailView):
#     model = Broadcast
#     slug_field = 'number'
# 
# class BroadcastListView(ListView):
#     model = Broadcast
# 
#     def calculate_highlights_per_episode(self, **kwargs):
#         episodes = Broadcast.objects.count()
#         highlights = Highlight.objects.count()
#         return round((highlights / episodes), 2)
# 
#     def calculate_raids_per_episode(self, **kwargs):
#         # Subtract 50 from the total number of episodes, since we only started
#         # recording raids at episode 51.
#         episodes = Broadcast.objects.count() - 50
#         raids = Raid.objects.count()
#         return round((raids / episodes), 2)
# 
#     def get_context_data(self, **kwargs):
#         context = super().get_context_data(**kwargs)
#         context['first'] = Broadcast.objects.earliest()
#         context['games'] = Game.objects.all()
#         context['games_completed'] = Game.objects.filter(is_completed=True)
# 
#         # Highlights.
#         context['highlights'] = Highlight.objects.all()
#         context['highlights_per_episode'] = self.calculate_highlights_per_episode()
# 
#         # Raids.
#         context['raids'] = Raid.objects.all()
#         context['raids_per_episode'] = self.calculate_raids_per_episode()
#         return context


# Path: apps/broadcasts/urls.py
from django.conf.urls import url
from .views import BroadcastDetailView, BroadcastListView

# -*- coding: utf-8 -*-



urlpatterns = [
    url(r'^episode/(?P<slug>[-\w]+)/$', name='broadcast-detail', view=BroadcastDetailView.as_view()),
    url(r'^broadcasts/$', name='broadcast-list', view=BroadcastListView.as_view()),

]