Skip to content

Commit

Permalink
fix(sections): cleaned stats, removed redundant button
Browse files Browse the repository at this point in the history
  • Loading branch information
thejoeejoee committed Nov 15, 2023
1 parent 52660a4 commit a59422c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.

This file was deleted.

23 changes: 14 additions & 9 deletions fiesta/apps/sections/views/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
from django.db import models
from django.db.models import Count, OuterRef, Subquery
from django.db.models.functions import Coalesce
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from django_tables2 import Column, Table, TemplateColumn
from django_tables2 import Column, Table

from apps.buddy_system.models import BuddyRequest
from apps.fiestatables.filters import BaseFilterSet, ProperDateFromToRangeFilter
Expand Down Expand Up @@ -52,18 +53,22 @@ def qs(self):


class BuddyStatsTable(Table):
abbr = Column(verbose_name=_("Faculty"), attrs=dict(td=dict(title=lambda record: record.name)))
matched_buddy_requests = Column(verbose_name=_("Matched requests"))

actions = TemplateColumn(template_name="sections/parts/section_stats_buddy_btn.html")
university = Column(
verbose_name=_("University"), accessor="university.name", attrs=dict(td=dict(title=lambda record: record.name))
)
faculty = Column(verbose_name=_("Faculty"), accessor="abbr", attrs=dict(td=dict(title=lambda record: record.name)))
matched_buddy_requests = Column(
verbose_name=_("Matched requests"),
linkify=lambda record: reverse("buddy_system:requests") + f"?matcher_faculty={record.pk}",
)

class Meta:
model = Faculty
fields = ("abbr",)

sequence = (
"abbr",
"...",
fields = (
"university",
"faculty",
"matched_buddy_requests",
)


Expand Down

0 comments on commit a59422c

Please sign in to comment.