Skip to content

Commit

Permalink
Shift partner only from working members.
Browse files Browse the repository at this point in the history
  • Loading branch information
Theophile-Madet committed Dec 5, 2024
1 parent 0f126a5 commit 985cf89
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/statistics/datasets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ export const datasets: { [key: string]: Dataset } = {
},
[datasetNumberOfShiftPartners]: {
display_name: gettext("Shift partners"),
description: gettext(
"Counted out of working members only: a frozen member with a shift partner is not counted",
),
apiCall: api.statisticsNumberOfShiftPartnersAtDateRetrieve,
chart_type: "line",
relative: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
from tapir.coop.models import ShareOwner, MemberStatus
from tapir.shifts.models import ShiftUserData
from tapir.shifts.services.shift_partner_history_service import (
ShiftPartnerHistoryService,
)
from tapir.statistics.views.fancy_graph.base_view import DatapointView
from tapir.statistics.views.fancy_graph.base_view import (
DatapointView,
get_shift_user_datas_of_working_members_annotated_with_attendance_mode,
)


class NumberOfShiftPartnersAtDateView(DatapointView):
def get_datapoint(self, reference_time) -> int:
active_members = ShareOwner.objects.with_status(
MemberStatus.ACTIVE, reference_time
)
shift_user_datas = ShiftUserData.objects.filter(
user__share_owner__in=active_members
shift_user_datas = (
get_shift_user_datas_of_working_members_annotated_with_attendance_mode(
reference_time
)
)

shift_user_datas = ShiftPartnerHistoryService.annotate_shift_user_data_queryset_with_has_shift_partner_at_date(
Expand Down

0 comments on commit 985cf89

Please sign in to comment.