Content
View differences
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") "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 `friendly_id` 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
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) ??? (please add if you have more ideas)
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 `friendly_id` 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
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) ??? (please add if you have more ideas)