Closed famoser closed 2 years ago
Offending issues can be found with:
SELECT * FROM issues WHERE registered_at IS NULL AND (closed_at IS NOT NULL OR resolved_at IS NOT NULL)
Following queries should be executed:
UPDATE issue SET closed_at = NULL AND closed_by_id = NULL AND resolved_by_id = NULL AND resolved_at = NULL WHERE id IN (SELECT id FROM `issue` WHERE registered_at IS NULL AND (closed_at IS NOT NULL OR resolved_at IS NOT NULL) AND deleted_at IS NOT NULL
UPDATE issue SET closed_at = NULL AND closed_by_id = NULL AND resolved_by_id = NULL AND resolved_at = NULL AND deleted_at = NOW() AND deleted_by_id = *ADMIN_ID* WHERE id IN (SELECT id FROM `issue` WHERE registered_at IS NULL AND (closed_at IS NOT NULL OR resolved_at IS NOT NULL) AND deleted_at IS NOT NULL
(replace ADMIN_ID by construction manager id of admin)
This does not make sense as issues are already closed the craftsman has not even seen yet. The UI dialogue in web should not be provided.
The inconsistent state should be cleaned up: These issues should be removed. removedAt will be done by an administrator, so it can be reconstructed in the future.