Skip to content

add filter form to workinghour detail view, export workinghours#1809

Open
jeriox wants to merge 2 commits intomainfrom
workinghours
Open

add filter form to workinghour detail view, export workinghours#1809
jeriox wants to merge 2 commits intomainfrom
workinghours

Conversation

@jeriox
Copy link
Copy Markdown
Contributor

@jeriox jeriox commented Apr 3, 2026

closes #1780
closes #838

@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 81.356%. remained the same
when pulling 7e63c92 on workinghours
into 9f8c6ea on main.

@jeriox jeriox requested a review from felixrindt April 4, 2026 17:46

def get_workhour_items(self):
def get_workhour_items(
self, start: date = date.min, end: date = date.max, eventtype: Optional[EventType] = None
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Next to the red tests, with #1806 in mind, this will raise a linting error (use T | None instead of Optional[T]).

Comment on lines +213 to +221
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"),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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"),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
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",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"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):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Comment on lines +33 to +34
<a class="btn btn-sm btn-secondary"
href="{% url "core:workinghours_request" %}"><span class="fa fa-plus"></span> {% translate "Request working hours" %}</a>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

List export should also be available on your own profile imo.

Comment on lines +290 to +293
entry["date"],
entry["reason"],
timedelta_in_hours(entry["duration"]),
entry["type"],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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. 🤔

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.

Filter working hours Export working hours as CSV

3 participants