Content
View differences
Updated by Jens Ulferts almost 3 years ago
### Steps to reproduce
_Please write down the steps to reproduce. Try to write down all necessary preconditions (what permissions do you have, are other users involved?). Example:_
1. Have a work package
2. Change a custom field value (e.g. change an integer CF from 1 to 2)
3. Go to the work package list.
4. Filter for the old value of the CF (e.g. integer CF set to 1 - which the work package no longer has) that custom field
5. 4. Enable baseline filtering and set the date to be at Include a time before the change timestamp query prop to the custom field request
### What is the buggy behavior?
_Please describe the bug in as much detail as possible. Example:_
* The work package having had For custom fields, the value current `custom_values` are always used for the custom field at the baseline time will not show up in the work package list filtering even though it had the filtered for value at that time. ones from the `customizable_journals` should be used.
### What is the expected behavior?
_Describe how the application should behave like. Example:_
1. The work package should be displayed in returned as part of the list collection as it matches used to match the custom field filter at the baseline time. first time stamp even if it no longer does.
### **Logs**
* For custom fields, the current `custom_values` are always used for filtering even though the ones from the `customizable_journals` should be used.
```SQL
SELECT "work_packages"."id" FROM "work_packages" LEFT OUTER JOIN "projects" ON "projects"."id" = "work_packages"."project_id" WHERE "work_packages"."project_id" IN (SELECT "projects"."id" FROM "projects" INNER JOIN "enabled_modules" ON "projects"."id" = "enabled_modules"."project_id" AND "enabled_modules"."name" IN ('work_package_tracking') AND "projects"."active" = TRUE WHERE "projects"."active" = TRUE) AND ( work_packages.id IN
(SELECT work_packages.id
FROM work_packages
LEFT OUTER JOIN custom_values
ON custom_values.customized_type = 'WorkPackage'
AND custom_values.customized_id = work_packages.id
AND custom_values.custom_field_id = 5
JOIN custom_fields_types
ON custom_fields_types.type_id = work_packages.type_id
AND custom_fields_types.custom_field_id = 5
WHERE custom_values.value IN ('517'))
) AND "work_packages"."id" IN (SELECT "work_packages"."id" FROM "work_packages" WHERE "work_packages"."id" IN (SELECT journals.journable_id as id FROM "work_package_journals" INNER JOIN "journals" ON "journals"."data_type" = 'Journal::WorkPackageJournal' AND "journals"."data_id" = "work_package_journals"."id" INNER JOIN (SELECT id, created_at, project_id FROM "work_packages") AS journables ON "journables"."id" = "journals"."journable_id" LEFT OUTER JOIN "projects" ON "projects"."id" = "journables"."project_id" WHERE "work_package_journals"."project_id" IN (SELECT "projects"."id" FROM "projects" INNER JOIN "enabled_modules" ON "projects"."id" = "enabled_modules"."project_id" AND "enabled_modules"."name" IN ('work_package_tracking') AND "projects"."active" = TRUE WHERE "projects"."active" = TRUE) AND ( journals.journable_id IN
(SELECT journals.journable_id
FROM work_packages
LEFT OUTER JOIN custom_values
ON custom_values.customized_type = 'WorkPackage'
AND custom_values.customized_id = journals.journable_id
AND custom_values.custom_field_id = 5
JOIN custom_fields_types
ON custom_fields_types.type_id = work_package_journals.type_id
AND custom_fields_types.custom_field_id = 5
WHERE custom_values.value IN ('517'))
) AND (( journals.journable_id IN
(SELECT journals.journable_id
FROM work_packages
LEFT OUTER JOIN custom_values
ON custom_values.customized_type = 'WorkPackage'
AND custom_values.customized_id = journals.journable_id
AND custom_values.custom_field_id = 5
JOIN custom_fields_types
ON custom_fields_types.type_id = work_package_journals.type_id
AND custom_fields_types.custom_field_id = 5
WHERE custom_values.value IN ('517'))
) AND (journals.journable_id IN ('45414'))) AND "journals"."journable_type" = $1 AND "journals"."id" IN (SELECT distinct on (journable_type, journable_id) id FROM "journals" WHERE "journals"."journable_type" = $2 AND "journals"."created_at" <= $3 ORDER BY "journals"."journable_type" ASC, "journals"."journable_id" ASC, "journals"."created_at" DESC))) ORDER BY work_packages.id LIMIT $4 OFFSET $5 [["journable_type", "WorkPackage"], ["journable_type", "WorkPackage"], ["created_at", "2023-03-16 08:31:00.786501"], ["LIMIT", 500], ["OFFSET", 0]]
```
###
_Please write down the steps to reproduce. Try to write down all necessary preconditions (what permissions do you have, are other users involved?). Example:_
1. Have a work package
2. Change a custom field value (e.g. change an integer CF from 1 to 2)
3. Go to the work package list.
4. Filter for the old value of the CF (e.g. integer CF set to 1 - which the work package no longer has)
5.
### What is the buggy behavior?
_Please describe the bug in as much detail as possible. Example:_
* The work package having had
### What is the expected behavior?
_Describe how the application should behave like. Example:_
1. The work package should be displayed in
### **Logs**
* For custom fields, the current `custom_values` are always used for filtering even though the ones from the `customizable_journals` should be used.
```SQL
SELECT "work_packages"."id" FROM "work_packages" LEFT OUTER JOIN "projects" ON "projects"."id" = "work_packages"."project_id" WHERE "work_packages"."project_id" IN (SELECT "projects"."id" FROM "projects" INNER JOIN "enabled_modules" ON "projects"."id" = "enabled_modules"."project_id" AND "enabled_modules"."name" IN ('work_package_tracking') AND "projects"."active" = TRUE WHERE "projects"."active" = TRUE) AND ( work_packages.id IN
(SELECT work_packages.id
FROM work_packages
LEFT OUTER JOIN custom_values
ON custom_values.customized_type = 'WorkPackage'
AND custom_values.customized_id = work_packages.id
AND custom_values.custom_field_id = 5
JOIN custom_fields_types
ON custom_fields_types.type_id = work_packages.type_id
AND custom_fields_types.custom_field_id = 5
WHERE custom_values.value IN ('517'))
) AND "work_packages"."id" IN (SELECT "work_packages"."id" FROM "work_packages" WHERE "work_packages"."id" IN (SELECT journals.journable_id as id FROM "work_package_journals" INNER JOIN "journals" ON "journals"."data_type" = 'Journal::WorkPackageJournal' AND "journals"."data_id" = "work_package_journals"."id" INNER JOIN (SELECT id, created_at, project_id FROM "work_packages") AS journables ON "journables"."id" = "journals"."journable_id" LEFT OUTER JOIN "projects" ON "projects"."id" = "journables"."project_id" WHERE "work_package_journals"."project_id" IN (SELECT "projects"."id" FROM "projects" INNER JOIN "enabled_modules" ON "projects"."id" = "enabled_modules"."project_id" AND "enabled_modules"."name" IN ('work_package_tracking') AND "projects"."active" = TRUE WHERE "projects"."active" = TRUE) AND ( journals.journable_id IN
(SELECT journals.journable_id
FROM work_packages
LEFT OUTER JOIN custom_values
ON custom_values.customized_type = 'WorkPackage'
AND custom_values.customized_id = journals.journable_id
AND custom_values.custom_field_id = 5
JOIN custom_fields_types
ON custom_fields_types.type_id = work_package_journals.type_id
AND custom_fields_types.custom_field_id = 5
WHERE custom_values.value IN ('517'))
) AND (( journals.journable_id IN
(SELECT journals.journable_id
FROM work_packages
LEFT OUTER JOIN custom_values
ON custom_values.customized_type = 'WorkPackage'
AND custom_values.customized_id = journals.journable_id
AND custom_values.custom_field_id = 5
JOIN custom_fields_types
ON custom_fields_types.type_id = work_package_journals.type_id
AND custom_fields_types.custom_field_id = 5
WHERE custom_values.value IN ('517'))
) AND (journals.journable_id IN ('45414'))) AND "journals"."journable_type" = $1 AND "journals"."id" IN (SELECT distinct on (journable_type, journable_id) id FROM "journals" WHERE "journals"."journable_type" = $2 AND "journals"."created_at" <= $3 ORDER BY "journals"."journable_type" ASC, "journals"."journable_id" ASC, "journals"."created_at" DESC))) ORDER BY work_packages.id LIMIT $4 OFFSET $5 [["journable_type", "WorkPackage"], ["journable_type", "WorkPackage"], ["created_at", "2023-03-16 08:31:00.786501"], ["LIMIT", 500], ["OFFSET", 0]]
```
###