31 Commits

Author SHA1 Message Date
ulferts 7b2fde2eb1 remove job no longer referenced 2025-07-22 14:54:30 +02:00
ulferts 2b68eb08ad squash migrations below 15.0 2025-07-22 14:54:28 +02:00
Alexander Brandon Coles 03572f4444 Freeze string literals in app/workers
rubocop -A --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment,Style/RedundantFreeze app/workers
2025-07-18 17:42:42 +01:00
Christophe Bliard 4b6056b333 refactor: Extract methods to deal with % complete modes
To keep all future usages of "work_weighted_average" and
"simple_average" magic strings at the same place.
2025-07-08 18:20:05 +02:00
Christophe Bliard 381e2f4b09 [57990] Make migration work with database from before 14.0 version
https://community.openproject.org/wp/57990

The code to create the temporary table in common between the migration
and the job to update status and % complete values. It has recently
changed to get the `excluded_from_totals` value from the `statuses`
table, but this field has been created in 14.2, and does not exist yet
in 14.0 when this migration is run.

This commit adds the previous version of the code to create the
temporary table, that does not require the `excluded_from_totals` field.
It also avoids creating the depths table which is not necessary in this
case.
2024-09-26 15:11:51 +02:00
Aaron Contreras de86221361 Extract common operations to sql_commands 2024-09-25 13:54:31 -05:00
Aaron Contreras 95cda6de29 Remove unnecessary update 2024-09-25 13:49:09 -05:00
Aaron Contreras 946b57d9e5 Merge branch 'dev' into implementation/57529-options-for-total-calculation-sum-mode 2024-09-25 13:20:38 -05:00
Christophe Bliard 3250f5104a Compute total % complete according to mode in update status job
Reuse and duplicate a lot of logic from the other job. It needs to be
reworked, but it works
2024-09-25 17:13:35 +02:00
Christophe Bliard 3f97171b79 Use work_package_hierarchies to create depth table
Simpler.
2024-09-25 17:12:34 +02:00
Christophe Bliard 4ac1b1ca7a Remove :percent_complete_edition feature flag
% complete edition will be released in 14.6
2024-09-25 15:31:11 +02:00
Aaron Contreras 1f12393880 Account for status exclusion from total calculations in simple average mode 2024-09-24 16:56:36 -05:00
Aaron Contreras 2f2561c08f Add in simple average calculation mode job
* Adds temporary depth table - Could be cleaned up down thie line with
  the `work_package_hierarchies` table.
2024-09-24 16:35:58 -05:00
Aaron Contreras 6cbfdc8e78 Trigger the recalculation job when changing to work weighted mode
* Triggers job
* Adds journal entries with specs and translations
2024-09-24 11:10:22 -05:00
Aaron Contreras 503ad154ca Add recalculation in job when switching to work weighted mode
* Missing to add journal entries
2024-09-24 11:10:21 -05:00
Christophe Bliard 0368f40b66 Fix rubocop Metrics/AbcSize warning 2024-09-23 16:38:04 +02:00
Christophe Bliard 35b583bc35 refactor: rename methods to avoid abbreviations 2024-09-23 14:34:03 +02:00
Christophe Bliard eb9283507f [57990] Preserve % Complete over Remaining work when migrating
https://community.openproject.org/wp/57990

In 14.0, Work and Remaining work were deemed more important than
% Complete. Now in 14.6, as % Complete becomes editable and more
important, we want to preserve it over Remaining work for users having
not yet migrated to version 14.0.
2024-09-23 14:34:03 +02:00
Christophe Bliard f0f1e9eca6 Clear % complete when work is 0h when switching to work-based mode
That prevent having something like W=0h RW=0h %C=60% which leads to an
error being displayed when the popover is open.
2024-08-23 15:49:16 +02:00
Christophe Bliard 4647786916 Fix missed work derivation when switching progress calculation modes
If a work package has only remaining work being set and progress
calculation mode is changed from work-based to status-based, then work
package gets a % complete value.

Remaining work and % complete being both present, work has to be
derived.
2024-08-23 15:26:04 +02:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Christophe Bliard 8c82acdccd Update app/workers/work_packages/progress/apply_statuses_change_job.rb
Co-authored-by: Aaron Contreras <61627014+aaron-contreras@users.noreply.github.com>
2024-06-03 17:59:10 +02:00
Christophe Bliard 5e4766f072 Merge branch 'dev' into feature/49409-status-exclude-from-totals 2024-06-03 17:56:41 +02:00
Marcello Rocha 36108c86c0 Apply @ulferts feedback 2024-05-27 11:24:07 +02:00
Marcello Rocha 42dce573e2 Makes sure jobs are eventually discarded when concurrency happens 2024-05-27 11:24:05 +02:00
Christophe Bliard 15716cb04c Compute totals even if all children are excluded
There was a bug in the way the excluded work packages were affecting the
query which updates the totals, especially regarding looking at the
`MAX(generations)` value. When considering work packages after filtering
out excluded work packages, the parent is alone, and its
`MAX(generations)` is 0, which is interpreted like it is a leaf work
package and leading to totals being unset, which is not correct.

Now the check for `MAX(generations) > 0` is done outside of the
filtering to prevent this bug from happening.
2024-05-23 14:04:01 +02:00
Christophe Bliard e03d626897 [49409] Update cause messages for status changes
- Update the messages according to latest specification
- Update the journal cause to handle multiple changes in one cause
2024-05-22 14:45:39 +02:00
Christophe Bliard 6b4c0dccf2 [49409] Handle excluded statuses from totals in update job
The job has been updated to excluded work packages having a status with
`excluded_from_totals` set to true. The journal entry has valid values
so that the cause renders correctly.

The job is not yet triggered properly when the "excluded from totals"
attribute of a status is changed in the administration.
2024-05-15 12:35:47 +02:00
Christophe Bliard af0de2f103 refactor: Simplify SQL command 2024-05-07 08:12:19 +02:00
Christophe Bliard 5ea2e93c82 Remove a useless left join 2024-05-06 17:02:34 +02:00
Christophe Bliard 708aaba387 [54646] Remove totals of childless work packages in a migration
https://community.openproject.org/wp/54646

A concurrency key has been set on all jobs updating progress values to
ensure that only one job is performed at a time.

All classes related to managing progress updates in jobs has been moved
to a specific folder.
2024-05-06 11:48:05 +02:00