Skip to content

feat: #704 extend shareowner view with capability experience filter - #784

Open
zormit wants to merge 1 commit into
SuperCoopBerlin:masterfrom
zormit:has-recent-capability-experience
Open

feat: #704 extend shareowner view with capability experience filter#784
zormit wants to merge 1 commit into
SuperCoopBerlin:masterfrom
zormit:has-recent-capability-experience

Conversation

@zormit

@zormit zormit commented May 21, 2026

Copy link
Copy Markdown

The filter checks whether the user completed a shift in the last 6 months that required the selected capability.

Comment thread tapir/core/tasks.py Outdated
for capability, capability_name in SHIFT_USER_CAPABILITY_CHOICES.items()
],
method="has_recent_capability_experience_filter",
label=_("Has completed a shift with this qualification in the last 6 months"),

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • agree on label string, then add to translation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good

Comment thread tapir/coop/config.py
Comment on lines 10 to 11
# This is not very clean, we need a better solution to inject member filters from the shift app into the coop app
# without adding a dependency from the coop app to the shift app

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I continued with this hack for now, otherwise I think #704 will grow into a non-beginner-friendly task :)

happy to refactor this, if you have ideas and can guide me

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a suggestion? I'm no big backend expert

…rience filter

The filter checks whether the user completed a shift in the last 6 
months that required the selected capability.
@zormit
zormit force-pushed the has-recent-capability-experience branch from efc23f1 to 55face9 Compare May 21, 2026 12:19
@zormit
zormit marked this pull request as ready for review May 21, 2026 12:21

@crosspolar crosspolar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zormit , thanks for your PR. It would be great if you could add another test (I guess you can add one to TestShareOwnerList) but otherwise looks pretty solid.

Comment thread tapir/shifts/utils.py
state__in=[ShiftAttendance.State.DONE],
slot__shift__start_time__gt=six_months_ago,
)
.distinct()

@crosspolar crosspolar May 27, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove distinct since user IDs are naturally unique

Comment thread tapir/shifts/utils.py
ShiftAttendance.objects.filter(
slot__required_capabilities__contains=[capability],
state__in=[ShiftAttendance.State.DONE],
slot__shift__start_time__gt=six_months_ago,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick, but I would include the day and use gte, so you really have 6 months. slot__shift__start_time__date__gte

Comment thread tapir/coop/config.py
Comment on lines 10 to 11
# This is not very clean, we need a better solution to inject member filters from the shift app into the coop app
# without adding a dependency from the coop app to the shift app

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a suggestion? I'm no big backend expert

@Theophile-Madet Theophile-Madet left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, as Frederik said we'd need automated tests. Let us know if you need help getting started with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants