Content
View differences
Updated by Judith Roth 3 days ago
We want to have project-based semantic work package IDs. That means when we want to find the project for e.g. the `/wp/<identifier>` route (and all other routes containing work package IDs), we have 3 possible kinds of identifiers which we need to check for:
1. database ID (e.g. "123")
2. semantic ID based on the current project identifier (e.g. "SCO-5" with a project with current identifier "SCO")
3. semantic ID based on a previous project identifier (e.g. "SC-5" with a project with historic identifier "SC")
Options to find work packages:
a) Overwrite `.find` (like e.g. like `friendly_id` offers to do) also does
Pro:
* easy to use - not controllers etc. need to be adapted, because they already do `.find` on `WorkPackage`
* same as `friendly_id` does on `Project`
Contra:
* maybe unexpected
* `.find` and `.exists?` should have matching behaviour - if `.find` returns a record, `.exists?` should return true. `.exists?` is harder to overwrite correctly, because it has more options (e.g. conditions)
b) Add a new `.enhanced_find` method (the name of the method is up for debate)
Pro:
* we don't need to overwrite `.exists?`
Contra:
* we need to adapt all controllers (and every future developer creating more controllers that work with work packages needs to use that, too)
c) Extend friendly\_id finder methods to cater for `find` and `exist?` functions
1. database ID (e.g. "123")
2. semantic ID based on the current project identifier (e.g. "SCO-5" with a project with current identifier "SCO")
3. semantic ID based on a previous project identifier (e.g. "SC-5" with a project with historic identifier "SC")
Options to find work packages:
a) Overwrite `.find` (like e.g.
Pro:
* easy to use - not controllers etc. need to be adapted, because they already do `.find` on `WorkPackage`
* same as `friendly_id` does on `Project`
Contra:
* maybe unexpected
* `.find` and `.exists?` should have matching behaviour - if `.find` returns a record, `.exists?` should return true. `.exists?` is harder to overwrite correctly, because it has more options (e.g. conditions)
b) Add a new `.enhanced_find` method (the name of the method is up for debate)
Pro:
* we don't need to overwrite `.exists?`
Contra:
* we need to adapt all controllers (and every future developer creating more controllers that work with work packages needs to use that, too)
c) Extend friendly\_id finder methods to cater for `find` and `exist?` functions