80 Commits

Author SHA1 Message Date
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
Christophe Bliard 1af5aea5b0 [38030] Add parent relation to relations tab 2025-04-18 16:24:59 +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 ba96b46f81 refactor: Integrate PR review comments
Most notable is that computation of closest relation has been moved to
the ClosestRelation class.

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>
2025-04-02 09:46:52 +02:00
Christophe Bliard 957a91cc69 [62607] Always display relations in the relations tab in a fixed order
https://community.openproject.org/wp/62607

The order of the relation groups was not consistent from one work
package to another. It's because the relations are returned in any order
from the database.

Instead of getting relations from database and then grouping them by
type as they come up in the array, get the types in the order we want
and build up the relation groups from there.

There are no differences between rendering a `RelationGroup` of type
child and a `RelationGroup` of type relation anymore. For this to
happen, the "children" type had to be renamed "child", which is in line
with the Relation::TYPE_CHILD constant.
2025-04-01 13:57:48 +02:00
Christophe Bliard a9176a6b43 Merge branch 'feature/42388-new-automatic-scheduling-mode' into feature/47519-single-date-mode-for-work-package-date-pickers 2025-02-28 10:04:21 +01:00
Christophe Bliard 14a0adb7ef [61535] Can switch to automatic scheduling with indirect predecessors
https://community.openproject.org/wp/61535

A work package can have ancestors having predecessors. These
predecessors are indirect predecessors of the work package and are
involved in the scheduling if all the ancestors up to the predecessor
are automatically scheduled.

When such an indirect predecessor is present, the work package can be
switched to manual scheduling, even if it has no direct predecessors or
children.

It uses the scope `Relation#used_for_scheduling_of(work_package)` to
find all predecessors involved in scheduling. This encompass both direct
and indirect predecessors.
2025-02-27 19:00:15 +01:00
Alexander Brandon Coles 79ed18a35d Implement RelationGroup#closest_relation
Adds `WorkPackageRelationsTab::ClosestRelation`, encapsulating the
sorting logic in a custom comparator.
2025-02-27 13:31:19 -03:00
Christophe Bliard 1517b7cee0 [59539] Reschedule related work packages when deleting
From the deleted work package, its parent, its successors, and the
successors of its descendants are rescheduled and switched to manual
scheduling if appropriate.
2025-02-25 09:18:28 +01:00
Christophe Bliard 26fbc5522a [59539] switch scheduling mode when modifying follows relations
When a work package becomes a successor of another work package, its
scheduling mode is switched to automatic if it has no children so that
it can be scheduled as soon as possible automatically.

Similarly, when a work package is no longer a successor of any other
work package, its scheduling mode is switched to manual if it has no
children and no dates so that it can keep its current dates.
2025-02-25 09:12:25 +01:00
Christophe Bliard efb443af6e [59539] Update seeding data to be compatible with new automatic scheduling mode 2025-02-25 09:12:25 +01:00
Henriette Darge 7a243a54cf Show error messages for both from_id and to_id fields in the relations dialog 2025-02-13 12:53:27 +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 2bf07efdd7 add a validation to check if the value is not negative 2025-02-07 08:13:12 +01:00
Behrokh Satarnejad 64126ebc49 undo changes for validating a selecting a wp in relations modal, it is fixed in another pr#17776 2025-02-07 08:13:12 +01:00
Behrokh Satarnejad a79116311c set a validation for lag to to avoid saving long value for it and avoid 500 error 2025-02-07 08:13:11 +01:00
Behrokh Satarnejad 3e96e4e460 add validation to relations to check if to and from are selected 2025-02-07 08:13:11 +01:00
Behrokh Satarnejad 8cc0712586 change the order of relations in action menu list 2025-01-31 10:57:55 +01:00
Aaron Contreras 34fea8ed14 Group relations by directional semantics 2024-11-13 06:47:44 -05:00
Aaron Contreras 5088035971 i18n of relation labels and tab section 2024-11-13 06:47:44 -05: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 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
Christophe Bliard 21a696ef9b Update copyright information for 2023 2022-12-30 15:51:26 +01:00
ulferts c69f193432 include child relation type 2022-11-30 10:16:03 +01:00
Christophe Bliard f59dea8ce5 Reschedule work packages with delay when working days change
If delay is covering days with changing working status, they are updated
as well.
2022-09-21 16:49:52 +02: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
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
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 cc4ed56e2a use AR`s scope method instead of singleton class method (#8976)
* use AR`s scope method instead of singleton class method

By using the scope method, all of Rails` checks and method definition usually done on a method are now also performed on the extracted scope methods

https://github.com/rails/rails/blob/5f3ff60084ab5d5921ca3499814e4697f8350ee7/activerecord/lib/active_record/scoping/named.rb#L154-L190

* turn scope classes into modules
2021-02-05 10:53:44 +01: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 7e7b9132e3 Fix/child scheduling restrictions (#8584)
* allow free scheduling children of manualy scheduled parents

If a parent has a follows relations with another work package, that relationship also limites children of the work package. But if the work package is scheduled manually, this creates a scheduling barrier. Children of a manually scheduled work package are not hampered by the follows relationships of the parent or other ancestors.

* simplify soonest_start query

* eager load

* extract to scope
2020-08-25 06:45:01 +02:00
Oliver Günther 53f2d694ff Use AnyFixtures to generate fixtures from factories (#7230)
Uses FactoryBot to keep and maintain specific records in a special transaction that does not get removed after each spec.
They automatically are created whenever first hitting them.
This makes an excellent time saver for items that are commonly used, such as an admin user account
2020-04-09 11:54:26 +02:00
ulferts 9e2287bfcc rename and inflect according to zeitwerk 2020-02-21 20:47:24 +01:00
Henriette Dinger bd7f4e4814 Update copyright notice 2020-01-15 11:31:26 +01:00
ulferts 05a93695d4 automatically reverse relates relationship 2019-05-27 10:22:58 +02:00
Jens Ulferts 5799105e03 improve performance of relation query
By restructuring the `or` to be within the subselect, the query engine is able to filter down on the relations way more efficient than before.

As this query is used within WP scheduling, changes to the dates are more performant now. On my setup with about 500k relations on MySql, the change saved about 500ms
2018-04-11 13:11:36 +02:00
Jens Ulferts b50f9cad44 apply virtual_attribute to parent_id 2018-03-05 15:43:35 +01:00
Jens Ulferts 61dddffc15 move relation_type validation to contract 2018-03-05 15:43:35 +01:00
Jens Ulferts 7f12f43da6 extract relation_type into concern 2018-03-05 15:43:35 +01:00
Jens Ulferts 4aa0cca21c define relation_type to be an attribute 2018-03-05 15:43:35 +01:00