diff --git a/src/reviews/views.py b/src/reviews/views.py index 5eda7064b..47675612d 100644 --- a/src/reviews/views.py +++ b/src/reviews/views.py @@ -55,6 +55,10 @@ def get_ordering(self): order_key = self.order_keys.get(params.get('order', '').lower()) return order_key or '?' + def get_category(self): + params = self.request.GET + return params.get('category') + def get_queryset(self): user = self.request.user qs = ( @@ -64,10 +68,7 @@ def get_queryset(self): .exclude(review__reviewer=user) .annotate(Count('review')) ) - # params = self.request.GET - # category = params.get('category', '').upper() - # if category: - # proposals = proposals.filter(category=category) + ordering = self.get_ordering() if ordering == '?': # We don't use order_by('?') because it is crazy slow, and instead @@ -85,8 +86,23 @@ def get_queryset(self): else: qs = qs.order_by(ordering) self.ordering = ordering + self.category = self.get_category() + return qs + def get_category_metrics(self, context): + count = 0 + categories = set() + for proposal in context["object_list"]: + if proposal.category == self.category: + count += 1 + if proposal.category not in categories: + categories.add(proposal.category) + return { + "category_options": categories, + "filtered_count": count if count else len(context["object_list"]) + } + def get_context_data(self, **kwargs): review_stage = self.reviews_state.reviews_stage verdicted_proposals = ( @@ -132,8 +148,10 @@ def get_context_data(self, **kwargs): ), 'vote': vote_mapping, 'ordering': self.ordering, + 'category': self.category, 'query_string': self.request.GET.urlencode(), **self.reviews_state._asdict(), + **self.get_category_metrics(context), }) return context diff --git a/src/templates/default/reviews/_includes/proposal_table.html b/src/templates/default/reviews/_includes/proposal_table.html index 627a34bd6..fb4a65a2f 100644 --- a/src/templates/default/reviews/_includes/proposal_table.html +++ b/src/templates/default/reviews/_includes/proposal_table.html @@ -4,9 +4,9 @@ {% if not verdict %} - + {% trans 'Reviewed' %} @@ -15,8 +15,8 @@ {% endif %} - + {% trans 'Title' %} @@ -24,15 +24,30 @@ - + {% trans 'Lang' %} + + + {% if verdict %} {% trans 'Decision' %} {% endif %} @@ -41,6 +56,7 @@ {% for proposal in proposals %} + {% if proposal.category == category or not category %} {% if proposal.accepted == None %} {{ proposal.review__count }} @@ -49,8 +65,9 @@
reviews_enough %} class="grayed-out" {% endif %} >{{ proposal.title }}
{{ proposal.get_language_display }} + {{ proposal.category }} {% if proposal.accepted != None %} - {{ proposal.get_accepted_display }} + {{ proposal.get_accepted_display }} {% endif %} {% if proposal.accepted == None %} @@ -62,6 +79,7 @@ {% endif %} + {% endif %} {% endfor %} diff --git a/src/templates/default/reviews/talk_proposal_list.html b/src/templates/default/reviews/talk_proposal_list.html index 4d65c8393..76741b523 100644 --- a/src/templates/default/reviews/talk_proposal_list.html +++ b/src/templates/default/reviews/talk_proposal_list.html @@ -48,7 +48,7 @@

{% trans 'Personal Review Stats' %}