8000 feat: don't require editable filter to edit all reports by g-kedev · Pull Request #1599 · adfinis/timed · GitHub
[go: up one dir, main page]

Skip to content

feat: don't require editable filter to edit all reports - #1599

Open
g-kedev wants to merge 1 commit into
adfinis:mainfrom
g-kedev:feat/edit-all-possible-without-editable-filter
Open

g-kedev wants to merge 1 commit into
adfinis:mainfrom
g-kedev:feat/edit-all-possible-without-editable-filter

Conversation

@g-kedev
@g-kedev g-kedev commented Nov 9, 2026 •
Copy link
Copy Markdown
Contributor

Ref: #1601

@g-kedev
g-kedev force-pushed the feat/edit-all-possible-without-editable-filter branch 2 times, most recently from 0048de0 to 2fa319c Compare November 9, 2026 09:10
@g-kedev g-kedev self-assigned this Nov 9, 2026
@g-kedev
g-kedev force-pushed the feat/edit-all-possible-without-editable-filter branch 3 times, most recently from 3beaefe to 238a994 Compare November 10, 2026 08:54
@g-kedev
g-kedev marked this pull request as ready for review November 10, 2026 09:02
@g-kedev
g-kedev requested review from a team as code owners November 10, 2026 09:02
@g-kedev g-kedev assigned trowik and c0rydoras and unassigned trowik and c0rydoras Nov 10, 2026
@g-kedev
g-kedev requested review from c0rydoras and trowik November 10, 2026 14:04
view = self.context["view"]
queryset = view.filter_queryset(view.get_queryset())
filtered_queryset = ReportFilterSet.filter_editable(
view, queryset=queryset, _name="foobar", value=True
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.

What's this _name="foobar"??

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Filter editable requires a name parameter, but since it isn't even used I just pass some nonesense.

super().get_root_meta(resource, many)
if hasattr(super(), "get_root_meta")
else {}
)
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 would probably add the same if many: check as in TotalTimeRootMetaMixin

@g-kedev g-kedev Nov 13, 2026 •
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well currently you can use the edit all button even when you only have one report (the button doesn't get disabled). So if I add an if many check I would also have to add a check, that the button is disabled if less than two reports are selected. Would that be the desired behaviour?

Comment thread backend/timed/serializers.py Outdated
filtered_queryset = ReportFilterSet.filter_editable(
view, queryset=queryset, _name="foobar", value=True
)
meta["can_edit_all"] = queryset.count() == filtered_queryset.count()
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.

refactor to use exists() instead of counting both queries

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@g-kedev
g-kedev force-pushed the feat/edit-all-possible-without-editable-filter branch from 238a994 to 0d9b95a Compare November 13, 2026 15:11
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

0