Skip to content

Conversation

EinLama
Copy link
Contributor

@EinLama EinLama commented Aug 22, 2025

Ticket

https://community.openproject.org/wp/65740

What are you trying to accomplish?

The PDF export breaks since the query generated by our project_phase_select uses an alias for a sub select. The export and other modules such as costs generate a query that surrounds the original query. The surrounding query expects a certain structure and does not work with generated aliases.

I tried coming up with multiple solutions to this issue:

  • Get rid of the sub select alias by defining a scope on WorkPackage (or Phase). This fails since the group by query will only work with ActiveRecord associations.
  • Set up a virtual table and define it as an association -> Could not get this to work properly.
  • Define a view as a new association and use that for grouping/querying.
    • Works well for the most obvious parts. However, since inactive and invisible (to the user) phases should be treated like non-existing phases, a view cannot deliver the correct data, as the permission is determined on a per-request basis. Adding this additional rule afterwards is too late in the query. Attempts at resolving this later failed.
  • ...

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@EinLama EinLama force-pushed the bug/65740-error-when-exporting-wp-table-grouped-by-project-phase branch from 6c6c79b to 34bf3a4 Compare August 22, 2025 14:51
[#65740] migration for ActiveProjectPhase DB view
@EinLama EinLama force-pushed the bug/65740-error-when-exporting-wp-table-grouped-by-project-phase branch 2 times, most recently from ce294be to a220e07 Compare August 27, 2025 08:01
@EinLama EinLama force-pushed the bug/65740-error-when-exporting-wp-table-grouped-by-project-phase branch from a220e07 to db81b6a Compare August 27, 2025 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant