add filter form to workinghour detail view, export workinghours#1809
add filter form to workinghour detail view, export workinghours#1809
Conversation
|
|
||
| def get_workhour_items(self): | ||
| def get_workhour_items( | ||
| self, start: date = date.min, end: date = date.max, eventtype: Optional[EventType] = None |
There was a problem hiding this comment.
Next to the red tests, with #1806 in mind, this will raise a linting error (use T | None instead of Optional[T]).
| participations = participations.annotate( | ||
| duration=ExpressionWrapper( | ||
| (F("end_time") - F("start_time")), | ||
| output_field=models.DurationField(), | ||
| ), | ||
| date=ExpressionWrapper(TruncDate(F("start_time")), output_field=DateField()), | ||
| reason=F("shift__event__title"), | ||
| type=Value("event"), | ||
| origin_id=F("shift__event__pk"), |
There was a problem hiding this comment.
any reason why this is after the if in l. 211 and not chained to the initial queryset definition?
| @@ -1,3 +1,5 @@ | |||
| import codecs | |||
There was a problem hiding this comment.
always wondered why this file is not workingshours.py (plural)
| name="workinghours_request", | ||
| ), | ||
| path("workinghours/", WorkingHourOverview.as_view(), name="workinghours_list"), | ||
| path("workinghours/export", WorkingHourExportView.as_view(), name="workinghours_export"), |
There was a problem hiding this comment.
| path("workinghours/export", WorkingHourExportView.as_view(), name="workinghours_export"), | |
| path("workinghours/export/", WorkingHourExportView.as_view(), name="workinghours_export"), |
| name="workinghours_detail", | ||
| ), | ||
| path( | ||
| "workinghours/user/<int:pk>/export", |
There was a problem hiding this comment.
| "workinghours/user/<int:pk>/export", | |
| "workinghours/user/<int:pk>/export/", |
| def get_object(self, queryset=None): | ||
| return self.request.user | ||
|
|
||
| def get_context_data(self, **kwargs): |
There was a problem hiding this comment.
I think this view should also get the filter form. At my place we have this usecase where volunteers report hours in a specific event type for which they are eligible for compensation at the end of a year. That would be perfect for them to look up their own hours for this.
| <a class="btn btn-sm btn-secondary" | ||
| href="{% url "core:workinghours_request" %}"><span class="fa fa-plus"></span> {% translate "Request working hours" %}</a> |
There was a problem hiding this comment.
List export should also be available on your own profile imo.
| entry["date"], | ||
| entry["reason"], | ||
| timedelta_in_hours(entry["duration"]), | ||
| entry["type"], |
There was a problem hiding this comment.
I think it would be useful if - for events - this included the event type, so people could refine the analysis offline.
Might even make sense to have it in the multi user export as columns. 🤔
closes #1780
closes #838