42 Commits

Author SHA1 Message Date
Christophe Bliard f1ea26c381 refactor: make tests more expressive and explicit
Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>
2025-05-28 09:52:06 +02:00
Christophe Bliard 4797465986 [58011] Allow negative lag for predecessor/successor relations
https://community.openproject.org/wp/58011

This makes it possible to have a follower starting the same day a
predecessor ends, or at the same time as a predecessor starts.

Updated allowed lag range to be within -2000 to 2000 days.

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>
2025-05-28 09:28:32 +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
Christophe Bliard 7661671465 [62891][63152] Recalculate start date when toggling "Working days only"
https://community.openproject.org/wp/62891

For an automatically scheduled successor, when "Working days only" is
turned off and the day before the start date is a non-working day, the
start will shift to an earlier date. Multiple things need to work
correctly:

- The start date must be recalculated and displayed in the date picker.
- The mini calendar of the date picker need to have enabled dates
  updated, as the start date has changed.
- If the due date was not set manually, duration must be kept and due
  date will be recalculated.
- If the due date was set manually, it must not be changed and duration
  will be recalculated.
- If the due date was unset manually, it must remain unset and duration
  must be unset too.

Also the lag calculation was partly incorrect: it was adding non-working
days when "Working days only" was on, and days when "Working days only"
was off. This has been fixed: lag is always about working days
regardless of the successor "Working days only" setting.

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

When the browser timezone offset is negative, the enabled dates in the
date picker for an automatically scheduled successor were not correct:
the date before the start date was enabled.

This is now fixed.
2025-04-09 11:45:03 -04:00
Christophe Bliard c0a3e0edc3 table helpers: rename properties column to predecessors
It was only used to specify predecessors, so it makes more sense, and it
now allows a shorter syntax: "follows wp1, wp2, wp3".
2025-02-25 09:12:24 +01:00
Christophe Bliard 2d7288d317 [59539] Make work packages manually scheduled by default
The `schedule_manually` column is also non-nullable now.

This includes the following changes:

- Automatically scheduled parent dates are and `ignore_non_working_days`
  attributes are now always derived from children's values, even if the
  children are scheduled manually.

  It's more natural. Without that, adding a child to a work package
  would not change the parent's dates.

  As a consequence, the parent can start on a non-working day if one of
  its children is manually scheduled, ignores non-working days, and
  starts on a non-working day. That's why the parent's
  `ignore_non_working_days` attribute is now also derived from all its
  children regardless of the scheduling mode.

  If the parent is manually scheduled, its dates and it's ability to
  ignore non-working days will still be defined independently from its
  children.

- Fix tests broken by scheduling mode being manual by default.

  The tests had to be adapted to explicitly set scheduling mode to
  automatic for followers and parents, and sometimes even follower's
  children. Without it, work packages would not be rescheduled
  automatically.

- Replace schedule helpers with table helpers.

  Schedule helpers helped well, but table helpers are more flexible and
  support more column types.

- Add "days counting" and "scheduling mode" columns to table helpers.

  "days counting" to set `ignore_non_working_days` attribute.
    - "all days" value maps to `ignore_non_working_days: true`.
    - "working days" value maps to `ignore_non_working_days: false`.
  "scheduling mode" to set `schedule_manually` attribute.
    - "manual" value maps to `schedule_manually: true`.
    - "automatic" value maps to `schedule_manually: false`.
2025-02-25 09:12:22 +01:00
ulferts e41058ed04 use _id where appropriate to fix specs 2025-02-13 12:53:36 +01:00
Henriette Darge 153fff72e7 Show a form error when there is no WP selected before adding a relation via modal 2025-02-13 12:53:05 +01:00
Dombi Attila d4636bc2d7 Adjust error messages 2025-02-07 12:43:13 +02:00
Behrokh Satarnejad 7918c9a162 add test validation for lag with specific text 2025-02-07 08:13:13 +01:00
Behrokh Satarnejad d66440ca26 add test validation for lag 2025-02-07 08:13:12 +01:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Oliver Günther e3e8d78972 Rename delay to lag
https://community.openproject.org/work_packages/44054
2024-04-08 19:31:38 +02: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
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
Christophe Bliard 4c2a9d0aa8 Enable RSpec zero monkey patching mode
The plan for RSpec 4.0 is to disable monkey patching.

See https://github.com/rspec/rspec-core/blob/main/features/configuration/zero_monkey_patching_mode.feature for details.
2023-05-31 19:22:29 +02:00
Christophe Bliard 85b3258a29 Autocorrect with some rubocop cops
RSpec/Rails/InferredSpecType and Style/RedundantConstantBase

rubocop --autocorrect-all --only RSpec/Rails/InferredSpecType,Style/RedundantConstantBase spec modules/*/spec
2023-01-13 14:28:59 +01:00
Christophe Bliard 21a696ef9b Update copyright information for 2023 2022-12-30 15:51:26 +01:00
Christophe Bliard bb0b02e0db Fix scheduling bug with followers with delay
When a follows relation has a delay, and this delay covers some
non-working days, the soonest start date must be computed by having the
delay spanning only on working days, not on non-working days.
2022-09-21 16:46:51 +02:00
Christophe Bliard 48a4f1b6ad lint with rubocop --autocorrect (safe cops only) 2022-06-02 10:40:10 +02:00
ulferts 491928a3fd replace typed_dag with closure_tree and CTE 2022-03-29 12:02:55 +02:00
Christophe Bliard a33524ef6d remove ruby magic comment for utf-8
ruby interprets source encoding as utf-8 since 2.0.0, making magic comment redundant and useless
2022-03-10 19:36:58 +01:00
Christophe Bliard bc8d423ec2 update copyright information for 2022 2022-03-01 17:05:59 +01:00
Christophe Bliard 47a297daae Fix argument alignment since f08bea3467 (#10129)
* Fix argument alignment since f08bea3467

The FactoryBot.* prefix has been removed in f08bea3467. Since then
rubocop complains about Layout/ArgumentAlignment. This commit fixes it.

* do not fix alignments for modules/*/spec yet

hoping to be under the limit of 65535 characters for reviewdog to report on rubocop errors
2022-02-02 21:48:06 +01:00
Oliver Günther f08bea3467 Remove FactoryBot.* prefix where applicable 2022-01-25 08:19:06 +01:00
ulferts 8ff03e750f improves the performance of Relations#visible
In the former implementation, the partial index was not used leading to timouts when fetching the count on all visible relations. On the same database, the join
based approach leads to the sql statement taking 500ms which is not yet ideal but bearable.
2022-01-10 07:01:34 +01:00
Oliver Günther ccfa29c728 Move license and copyright docs to root, fix names and references 2021-09-02 21:50:46 +02:00
ulferts 6140f4c7e9 update copyright to 2021 (#8925)
Updates the copyright to 2021 for all files that have a copyright. Files in our source code without the copyright header still do not receive one automatically. Additionally, backlisted files are also excluded.

Previously the copyright of chiliproject which references redmine stated a copyright of redmine up to and including 2017 which is not true for the code we have in here. Because of that I changed that to 2013
2021-01-13 17:47:45 +01:00
ulferts 7fa2abf5fa adapt factory usages 2020-03-08 21:11:20 +01:00
Henriette Dinger bd7f4e4814 Update copyright notice 2020-01-15 11:31:26 +01:00
Oliver Günther 059770f533 FactoryGirl => FactoryBot
Removes the deprecation
2018-05-07 22:38:20 +02:00
Oliver Günther 6ef4211e77 Bump copyright to 2018 (#6171)
[ci skip]
2018-02-12 08:51:12 +01:00
Jens Ulferts 10a6e736f6 update former type column on changes to relation_type 2018-01-09 10:17:34 +01:00
Oliver Günther 0aa2f86f99 [26830] Fix updating a relation type
https://community.openproject.com/wp/26830
2018-01-08 12:20:44 +01:00
Jens Ulferts 690e0ffc60 wp create/update/destroy via services 2017-11-29 15:27:29 +01:00
Jens Ulferts 6fdd122534 merge wp tree and relations into typed_dag
Instead of having the tree/hierarchy information for work packages and
the relations between the work packages separated into two tables all
the information is now stored in the relations table.

To support this, the typed_dag plugin is used.

Notable changes:
* relations_to and relations_from are swapped. relations_to has all
relations that point to another work package (from_id = work_package.id)
and relations_from contains all relations that lead to the work package
from another one (to_id = work_package.id). This change is merely in the
code. The db information is left untouched.
* For follows/precedes to_id and from_id are swapped in the db. Because
of that, "follows" is now the canonical name instead of "precedes". This is
done so that hierarchy relations and follows relations point into the
same direction which allows to easily detect cyclic relationships that
would lead to infinit scheduling.
* the columns `root_id`, `lft`, `rgt` do no longer exist in the wp
table.
* the column `relation_type` does no longer exist in the relations
table.
* For every type of relation a column (integer) does now exist in the
relations table (e.g. hierarchy, block, follow)
* Separate associations exist for every type of relation into two
directions. E.g. Work packages following the current one can be accessed
via `work_package.precedes`
2017-10-18 10:41:31 +02:00
ulferts fc139e55df limit visibility of relations index (#5703)
[ci skip]
2017-06-28 07:14:58 +02:00
Oliver Günther 7cf11bb689 Update copyright notice 2017-01-10 15:11:43 +01:00
Jens Ulferts bcff977924 prevent circular dependency of 'from' relations
The previous implementation to detect circular dependencies was limited to detecting those circles, that originated in the 'to' work package of a relation. It did not prevent circles where the 'from' work package is involved. Now, both branches are checked.

While this removes the immediate issue, it also increases the time required for saving a relation. As long as our database does not provide us the capacity for recursive queries, this cannot be helped.
2016-10-12 08:02:17 +02:00
Oliver Günther 88cfd2d80f Extend and move relation spec 2016-10-07 10:10:35 +02:00