390 Commits

Author SHA1 Message Date
Oliver Günther 7ae5604869 Merge pull request #23070 from opf/fix/relation-visible-scope
The performance decreased because of a combination of calls that were supposed to increase performance. 

We have a mechanism in place which automatically eager loads models needed in the element representers when a collection of them is rendered. This is to avoid N+1 queries of course. But, if eager loading is  combined with e.g., a LIMIT, which we do because we paginate, rails automatically falls back to issuing two instead of just one SQL statement. Which makes sense as otherwise LEFT JOINS might mess with the result set. 

But Rails does so in a somewhat simple fashion. It uses the first query to get the DISTINCT ids. The second is used to load the values (without a limit). But instead of removing all WHERE statements in the second SQL statement and then apply just the one for the ids, it keeps the original WHERE statement and applies the one for the ids on top. The problem with that is that the database trips on that (I didn't check the why) and uses a less than optimal query plan. 

That was the problem here as well. The first query remained reasonable quick (300ms) but the second one took 25s. 

The fix is to split the two statements by hand in the representer whenever eager loading is defined. The first query has all the filters but no eager loading and fetches the ids. The second takes the ids, and with eager loading included loads the data. Et voila, second query takes 10ms.   

That at least works for relations, work_packages and projects. But there are other representers that also seem to have custom behaviour. I'm looking into whether they can be easily adapted.
2026-05-07 15:44:13 +02:00
ulferts 222639f8d4 include filter working with portfolios and programs 2026-04-30 10:18:09 +02:00
Tobias Dillmann a42eb98f87 [#73104] Move api resource link out of the model 2026-04-21 13:55:12 +02:00
Tobias Dillmann 4d3205636e [#73104] Remove backlogs module pollution from core
We delegate the resource name to the object itself, that way we can
override it in our record and no knowledge about the backlogs module is
necessary in the core.
2026-04-21 13:55:12 +02:00
Tobias Dillmann 281e44762f [#73104] Allow resource linking for sprints
This is necessary to make the group_by work
2026-04-21 13:55:12 +02:00
Oliver Günther 2194810144 Limit deflation of zlib to 10MB
https://community.openproject.org/work_packages/73368
2026-03-24 13:35:06 +01:00
Klaus Zanders 727cb945e8 Refactor UserNonWorkingDay into a model that covers date ranges 2026-03-06 13:28:35 +01:00
Klaus Zanders 4fdd8e70ad Add API endpoints to manage user working times 2026-03-06 13:27:53 +01:00
Ivan Kuchin 82086a3e35 consistent camel casting custom field injector fields, otherwise it is done automatically 2026-02-25 20:07:28 +01:00
Ivan Kuchin ce26539a2f comment schema injector 2026-02-25 20:07:03 +01:00
Ivan Kuchin e7b58a7db0 comment value injector 2026-02-25 20:07:01 +01:00
Ivan Kuchin 8d912b6bac move contditions of calculated value errors property 2026-02-25 20:07:01 +01:00
Kabiru Mwenja 1bca833cd5 Remove workspace aliasing unless confirmed 2026-01-29 13:50:24 +03:00
Kabiru Mwenja 8dbac61c57 Add project-scoped configuration API [OP#70979]
Adds `GET /api/v3/projects/:id/configuration` endpoint that returns
all global configuration properties plus project-specific settings.

This allows client apps to check both enterprise token features
(availableFeatures) and project settings (enabledInternalComments)
in a single API call.
2026-01-29 10:32:29 +03:00
ulferts 7653fbf66b workspace references in representers and auxilliary endpoints 2025-11-25 16:47:59 +01:00
ulferts d03bf6a763 adding workspace types endpoints 2025-11-25 16:32:58 +01:00
Jan Sandbrink b9f781bd90 Merge pull request #20766 from opf/auto-preload
Automatically pre- and eager-load collections
2025-11-25 13:42:08 +01:00
Ivan Kuchin bb566be958 pass workspace_type parameter for new project parent autocompleter 2025-11-24 13:51:08 +01:00
Jan Sandbrink a82257ac66 Automatically pre- and eager-load collections
Index endpoints will automatically discover and use
the `to_eager_load` and `to_preload` declarations of their
representers. This takes away the possibility of forgetting
to add those to the scope.

I found a few endpoint that didn't use them, when other endpoints
rendering the same collection did.

Interestingly the SCM integration modules consistently declared
those methods but never used them.
2025-11-10 16:16:05 +01:00
Yauheni Suhakou 0de0713a53 Big rename
Renames `scored_list` to `weighted_item_list`
2025-10-30 15:36:55 +01:00
Jan Sandbrink d462a4dc46 Simplify scope merging
The manual call to #includes came from a time,
when the constraint was not #merge'd, but rather
enforced through a `where(id:)` call. It's confusing today,
because the #merge call makes sure to take over all kinds of
eager loading:

* includes
* eager_load
* preload

However, the code could leave the impression, that only includes
is supported.
2025-10-24 14:47:00 +02:00
Jan Sandbrink 2d0d20713d Extract checking for selection into result method
Adding this method to the result makes it available to any
component involved in the SqlWalker implementation, so it
should be more reusable.

The code that's calculating the actual SELECT SQL statements is
not making use of the new helper, so some duplication still exists,
but hopefully we'll not deduplicate more than the current state.
2025-10-21 16:14:30 +02:00
Tobias Dillmann ddeff01500 [#64523] Use hierarchical_list? 2025-10-17 19:31:58 +02:00
Tobias Dillmann c6035e101e [#64523] API displays formatted_value for Scored Lists
This is the way it behaved before. We will keep it like it was.
2025-10-17 19:31:56 +02:00
Ivan Kuchin a17b1eb6f6 second attempt to not hardcode customized_type in API 2025-09-26 09:29:40 +02:00
Tobias Dillmann fcb9771218 [#66093] Revert "[#66093] Do not hardcode customized_type in API"
This reverts commit 1ab57e27f3.
2025-09-24 19:19:03 +02:00
Tobias Dillmann ba9eb9b830 [#66093] Do not hardcode customized_type in API 2025-09-24 19:19:03 +02:00
Tobias Dillmann b7b9a91ecb [#66093] API: capitalize errors correctly, use compact keys 2025-09-24 19:19:03 +02:00
Tobias Dillmann 6721538854 [#66093] Make CalculatedValueError polymorphic 2025-09-24 19:19:03 +02:00
Tobias Dillmann 653dd5eb33 [#66093] Move calculation error translations into helper 2025-09-24 19:19:03 +02:00
Tobias Dillmann f3751825ba [#66093] Remove redundant if
The check happens in the getter, too.
2025-09-24 19:19:03 +02:00
Tobias Dillmann 9ee1a6eb4e [#66093] API returns calculated value errors 2025-09-24 19:19:03 +02:00
Tobias Dillmann 8529f4eb56 [#66093] insert TODO for api error messages 2025-09-24 19:19:03 +02:00
Tobias Dillmann ceee1e8382 [#64530] API renders formula for calculated values 2025-09-14 17:34:39 +02:00
Eric Schubert d38f5220c1 [#66961] use scored list custom fields in work packages
- https://community.openproject.org/work_packages/66961
- adapt representer logic to handle scored lists
2025-08-28 12:52:47 +02:00
Eric Schubert cb6370e942 [#66413] adapted item component to show score
- https://community.openproject.org/work_packages/66413
- adapted apiv3 to return items correctly
2025-08-27 14:29:44 +02:00
Tobias Dillmann 3f70e956e9 [#64515] removing unneeded code
* remove unnecessary scope from phase api
* remove Arel
* remove unnecessary module definition
* remove unused paths from api helper

also added a missing spec
2025-06-12 10:42:27 +02:00
Tobias Dillmann 425294c145 [#62979] filter by phase definitions 2025-06-04 15:55:09 +02:00
Kabiru Mwenja 916c708f13 Simplify reminder PATCH,DELETE urls
"A reminder may be related to something that's not a work package conceptually.
 Lean towards simpler canonical URLs for reminders (`/api/v3/reminders/:id`) where operations like `DELETE` and `PATCH` are targeted.
 Because then we only need to define those routes once and the only thing we have to add when attaching reminders to a new container is `/api/v3/<container-name>/:id/reminders`."
   ~ https://github.com/opf/openproject/pull/19063#issuecomment-2935288456
2025-06-03 21:12:26 +03:00
Kabiru Mwenja 1b336f34a6 Add GET /api/v3/reminders endpoint (#19083)
An endpoint that lists all reminders for a user, regardless of the workpackage.
2025-06-03 18:13:36 +03:00
Kabiru Mwenja e5cd639d22 Add PATCH /api/v3/work_packages/:work_package_id/reminders/:reminder_id 2025-06-02 11:25:22 +03:00
Kabiru Mwenja 79bc96a73a Use the correct path for work package comments emoji reactions 2025-05-20 12:40:22 +03:00
Kabiru Mwenja 4447fcae2f implementation/64103 Extend API V3 to cover Emoji reactions on work package comments (read) and extend documentation
https://community.openproject.org/work_packages/64103
2025-05-19 18:48:49 +03:00
ulferts ad33c93054 Merge remote-tracking branch 'origin/dev' into implementation/62981-show-and-edit-linked-phases-on-work-packages 2025-04-29 11:40:43 +02:00
ulferts a896866548 link phase instead of defintion in wp representer 2025-04-17 10:27:07 +02:00
ulferts a18ef28118 show phase definition linked to work package 2025-04-17 10:27:06 +02:00
Kabiru Mwenja 2c6091db55 Add corresponding methods for activity dynamic models
* `Activity` -> attachments_by_activity
* `Activity::Comment` -> attachments_by_activity_comment
* `Activity::BcfComment` -> attachments_by_activity_bcf_comment
2025-04-10 10:46:12 +03:00
Kabiru Mwenja 00c7d1537a Make journals attachable in a basic form 2025-04-04 18:41:12 +03:00
Andreas Pfohl 7314758e32 [59920] Fixed group_by for single and multiselct hierarchy custom field 2024-12-19 11:00:57 +01:00
Kabiru Mwenja d9133a2e51 Merge branch 'dev' into implementation/59721-add-setedit-reminder-buttondialog-to-workpackage-page 2024-12-09 16:35:03 +03:00