165 Commits

Author SHA1 Message Date
Kabiru Mwenja 58a5e19669 bug/74156 Sort WP lists by project identifier, not project_id, in semantic mode (#23400)
Sort WP lists by project identifier, not project_id, in semantic mode

The semantic-mode "ID" sort grouped projects by project_id (insertion
order) before the per-project sequence. Projects added after others
landed below them in the list even when their identifier sorted
alphabetically earlier. Sort by projects.identifier instead so the order
matches the visible "<project identifier>-<sequence>" column.

The projects table is already joined for every work-package list query,
so the new sort term costs no extra round-trip.
2026-05-28 12:05:24 +03:00
Tomas Hykel 948fa43321 chore: Remove feature flag for project-based work package identifiers 2026-05-25 17:45:06 +02:00
Kabiru Mwenja 6de4e2a76b bug/74156 Lists of work packages should sort correctly in semantic mode (#23299)
Sort work packages by sequence_number in semantic mode

In semantic mode the visible "ID" is `<project_identifier>-<sequence_number>`,
but the list sort key was the database primary key. A work package moved
between projects keeps its primary key and receives a new sequence number
in the target project, so it could appear above natively-created rows with
higher sequence numbers — e.g. `LARGE-3` above `LARGE-1` and `LARGE-2`.

The "ID" sortable on the work-package query select now resolves at request
time. In semantic mode it returns `(work_packages.project_id, work_packages
.sequence_number)`, backed by the existing partial unique index. In classic
mode it stays `work_packages.id`. The Proc resolution lives in
`WorkPackageSelect#sortable` so every consumer (`Query::SortCriteria`,
group-by composition, the HAL/API sortBy resource) sees the resolved value.
2026-05-21 20:00:09 +03:00
Klaus Zanders 7742591418 Merge branch 'release/17.1' into merge-17.0-in-17.1 2026-02-26 14:36:00 +01:00
ulferts 608cc40e68 replace old visible methods on wp cf 2026-02-24 14:31:40 +01:00
Oliver Günther 896072d698 Release attribute highlighting to community 2026-01-30 15:02:45 +01:00
Eric Schubert c6ad2c3c8f [#66412] fixed test setup
- use new interface of persistence service
- use correct spec helper
2025-08-26 13:18:47 +02:00
Christophe Bliard af45df9d17 Fix broken spec
The factory for cost entries and time entries has changed, and it was
still using `work_package` instead of `entity`. This created additional work packages and made the test fail.
2025-07-11 16:33:34 +02:00
Christophe Bliard d0cbe87904 [63191] Show % Complete sum in more cases
https://community.openproject.org/wp/63191

Before, % Complete sum was calculated based on work and remaining work
sums, meaning work packages with only % Complete is set are ignored.

Now, if "Calculation of % Complete hierarchy totals" is set to "Simple
average", the % Complete sum is calculated as an average of the %
Complete values of work packages having % Complete set.

If "Calculation of % Complete hierarchy totals" is set to "Weighted by
work", the calculation is not changed: it is still based on work and
remaining work sums.
2025-07-09 10:03:23 +02:00
Christophe Bliard 8df4dbcb35 refactor: Make test failures easier to read
Having the full `Costs::QueryCurrencySelect`,
`Queries::WorkPackages::Selects::CustomFieldSelect`, or
`Queries::WorkPackages::Selects::PropertySelect` instances displayed
when there is a failure makes it hard to spot the wrong value.

Converting the column to its string name makes it easier to read.
2025-07-08 16:38:57 +02:00
Christophe Bliard 55944f1469 refactor: Make spec faster and add done_ratio values
`done_ratio` value would be there if the work packages were created from
UI.

Before:

Finished in 4.48 seconds (files took 6.1 seconds to load)
6 examples, 0 failures

Randomized with seed 2619

[TEST PROF INFO] Time spent in factories: 00:03.362 (63.5% of total time)
[TEST PROF INFO] Factories usage

 Total: 222
 Total top-level: 66
 Total time: 00:03.362 (out of 00:08.578)
 Total uniq factories: 15

   name                    total   top-level     total time      time per call      top-level time

   user                       30           6        0.6123s            0.0204s             0.2568s
   notification_setting       30           0        0.0832s            0.0028s             0.0000s
   work_package               24          24        1.2127s            0.0505s             1.2127s
   priority                   24           0        0.1269s            0.0053s             0.0000s
   status                     24           0        0.1421s            0.0059s             0.0000s
   project                    12           6        1.0206s            0.0851s             0.4532s
   cost_entry                 12          12        0.1650s            0.0138s             0.1650s
   cost_type                  12           0        0.0353s            0.0029s             0.0000s
   time_entry                 12          12        0.3732s            0.0311s             0.3732s
   time_entry_activity        12           0        0.0531s            0.0044s             0.0000s
   type                        6           6        0.9015s            0.1502s             0.9015s
   integer_wp_custom_field        6           0        0.1578s            0.0263s             0.0000s
   float_wp_custom_field        6           0        0.0329s            0.0055s             0.0000s
   project_role                6           0        0.1334s            0.0222s             0.0000s
   member                      6           0        0.0569s            0.0095s             0.0000s

After:

Finished in 2.1 seconds (files took 6.29 seconds to load)
6 examples, 0 failures

Randomized with seed 52572

[TEST PROF INFO] Time spent in factories: 00:01.089 (36.49% of total time)
[TEST PROF INFO] Factories usage

 Total: 23
 Total top-level: 12
 Total time: 00:01.089 (out of 00:06.142)
 Total uniq factories: 15

   name                    total   top-level     total time      time per call      top-level time

   work_package                4           4        0.3836s            0.0959s             0.3836s
   project                     2           2        0.3710s            0.1855s             0.3710s
   cost_entry                  2           0        0.0561s            0.0280s             0.0000s
   cost_type                   2           0        0.0095s            0.0048s             0.0000s
   time_entry                  2           0        0.0877s            0.0438s             0.0000s
   time_entry_activity         2           0        0.0118s            0.0059s             0.0000s
   integer_wp_custom_field        1           1        0.0997s            0.0997s             0.0997s
   float_wp_custom_field        1           1        0.0055s            0.0055s             0.0055s
   type                        1           1        0.0589s            0.0589s             0.0589s
   user                        1           1        0.1326s            0.1326s             0.1326s
   project_role                1           0        0.0495s            0.0495s             0.0000s
   member                      1           0        0.0274s            0.0274s             0.0000s
   notification_setting        1           0        0.0120s            0.0120s             0.0000s
   priority                    1           1        0.0193s            0.0193s             0.0193s
   status                      1           1        0.0183s            0.0183s             0.0183s
2025-07-08 16:15:14 +02:00
ulferts d6caec6c55 only display hierarchy option in dropdown if ee permits 2025-06-23 12:00:35 +02:00
Jan Sandbrink 0b87e7543f Freeze string literals in specs
Rolling out frozen string literals further by freezing all
string literals in core specs.
2025-05-05 09:29:55 +02:00
OpenProject Actions CI ee74fcb0e0 Merge branch 'release/15.5' into dev 2025-04-30 03:43:02 +00:00
ulferts 5cb3007141 fix sql alias when ordering&sorting by same table 2025-04-29 10:38:43 +02:00
Tobias Dillmann 216c0c64d8 [#57388] spec: query export settings 2025-04-03 11:34:31 +02:00
Christophe Bliard 74f1426227 [55802] Add % Complete sum to work packages table sums
https://community.openproject.org/wp/55802

It's calculated based on work sum and remaining work sum.

The % Complete sums have also been added to the PDF export.

Formatting of done_ratio values in the PDF export has been slightly
improved: when value is not there, it displays nothing now. Before it
was displaying a "%".
2025-03-27 16:38:30 +01:00
Tobias Dillmann a40079f7ad [#62317] redefine WorkPackageCustomField#visible_by_user scope
The old scope meant to determine if a user could "manage" custom fields.
It was never about seeing them. Updated the scope names to reflect that.
2025-03-21 09:49:07 +01:00
Tobias Dillmann 26f5232b3f [#36559] fix other specs 2025-03-13 13:11:25 +01:00
ulferts f1a42a3fa9 use appropriate role scopes 2025-02-11 22:31:28 +01:00
Bruno Pagno 441f320787 include specs 2024-11-29 13:16:39 +01:00
Ivan Kuchin 526d287ad4 order empty values before present values for all custom field formats 2024-11-12 12:42:36 +01:00
Ivan Kuchin 210d024f96 don't order absent versions, start date and due date to the end in both directions 2024-11-05 20:37:46 +01:00
Ivan Kuchin 8f23e532d2 improve a bit results version integration spec 2024-10-16 14:36:25 +02:00
Ivan Kuchin 4ddc1e603e fix sort criteria spec 2024-10-16 14:36:25 +02:00
Ivan Kuchin 7f8798557a correct order of versions in version custom field ordering 2024-10-16 14:36:24 +02:00
Ivan Kuchin 6199be82e3 handle ordering of multi value version custom fields 2024-09-26 12:16:14 +02:00
Ivan Kuchin 40af26bbe7 handle ordering of multi value user custom fields 2024-09-26 12:16:13 +02:00
Ivan Kuchin e0b1cb6178 test ordering of objects with same values in different order 2024-09-26 12:16:12 +02:00
Ivan Kuchin 8d916a2b1b fix variable name 2024-09-26 12:16:12 +02:00
Ivan Kuchin 749020dfa9 fix ordering of multi value list custom fields 2024-09-26 12:16:12 +02:00
Ivan Kuchin 5be7a1d930 use eq_array matcher to see difference in order when ordering by custom field is unexpected 2024-09-26 12:16:12 +02:00
Ivan Kuchin 89e1a347e6 add wp_without_cf_value helper 2024-09-24 14:22:31 +02:00
Ivan Kuchin 6b313e4a5b test all ordering using all custom field formats 2024-08-28 17:46:22 +02:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Ivan Kuchin 0b87ed9b6a remove newlines from context descriptions 2024-07-29 19:27:17 +02:00
Christophe Bliard a796209aa4 Merge branch 'dev' into feature/40749-consistent-calculation-of-percent-complete 2024-03-28 16:32:15 -05:00
OpenProject Actions CI 8847903104 Merge branch 'release/13.4' into dev 2024-03-26 03:35:15 +00:00
Oliver Günther f5fd2d2308 Add test 2024-03-25 13:28:40 +01:00
Christophe Bliard 03d9ff74a8 Switch to double quotes for files modified on this branch 2024-03-21 12:04:50 +01:00
Christophe Bliard d085f3e351 Merge branch 'dev' into feature/40749-consistent-calculation-of-percent-complete 2024-03-21 11:57:46 +01:00
ulferts 3b2121f733 Revert "Merge remote-tracking branch 'origin/release/13.4' into dev"
This reverts commit 40b2bbeb09, reversing
changes made to b4c6cb17cc.
2024-03-21 11:31:17 +01:00
Ivan Kuchin 7787e457a3 Revert "Merge branch 'dev' into release/13.4"
This reverts commit a901541269, reversing
changes made to e573ca00b7.
2024-03-20 20:19:08 +01:00
Ivan Kuchin 9e4934cd0a change quotes using rubocop --only Style/StringLiterals,Style/QuotedSymbols -a 2024-03-20 18:05:22 +01:00
Aaron Contreras 176b844f2d Update query sums test expectations 2024-03-05 10:39:24 -05:00
Aaron Contreras 310ed19af6 Lint: Don't tap to yield factory bot record 2024-03-05 10:39:24 -05:00
Christophe Bliard 8fa8584538 Run rubocop --autocorrect on all files
Only the safe cops have run. rubocop version is 1.59.0.
2024-01-05 15:27:09 +01:00
Christophe Bliard c795874f7f Update copyright year for 2024
command used: `rg -l 'Copyright \(C\) 2012-202\d the OpenProject' | xargs -n 100 sed -i -r 's/Copyright \(C\) 2012-202. the OpenProject/Copyright (C) 2012-2024 the OpenProject/'`
2024-01-02 16:23:54 +01:00
Klaus Zanders 2b0f8b9e41 Move scopes query into the correct folder 2023-10-23 15:05:40 +02:00
ulferts 5b2bc41f41 Merge remote-tracking branch 'origin/dev' into easier-factory-role-setup 2023-10-12 12:09:27 +02:00