feat: #704 extend shareowner view with capability experience filter - #784
feat: #704 extend shareowner view with capability experience filter#784zormit wants to merge 1 commit into
Conversation
| 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"), |
There was a problem hiding this comment.
- agree on label string, then add to translation
| # 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
efc23f1 to
55face9
Compare
crosspolar
left a comment
There was a problem hiding this comment.
@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.
| state__in=[ShiftAttendance.State.DONE], | ||
| slot__shift__start_time__gt=six_months_ago, | ||
| ) | ||
| .distinct() |
There was a problem hiding this comment.
I think you can remove distinct since user IDs are naturally unique
| ShiftAttendance.objects.filter( | ||
| slot__required_capabilities__contains=[capability], | ||
| state__in=[ShiftAttendance.State.DONE], | ||
| slot__shift__start_time__gt=six_months_ago, |
There was a problem hiding this comment.
nitpick, but I would include the day and use gte, so you really have 6 months. slot__shift__start_time__date__gte
| # 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 |
There was a problem hiding this comment.
Do you have a suggestion? I'm no big backend expert
Theophile-Madet
left a comment
There was a problem hiding this comment.
Looks good, as Frederik said we'd need automated tests. Let us know if you need help getting started with them.
The filter checks whether the user completed a shift in the last 6 months that required the selected capability.