dynamic attributes in where clause are a mess...
Reported by Gaspard Bucher | September 3rd, 2008 @ 03:20 PM | in later
Originally posted on Trac by gaspard Original Trac Ticket
Description (Last modified by gaspard)
finds wrong nodes
Example:
task 34 is assigned to john : d_assigned = 'john' later, task 34 is assigned to mary : d_assigned = 'mary' (creates a new version)
If we want to find tasks assigned to 'john', we do: tasks in site where d_assigned = john
But this will find task 34 since there is a version with this assignement.
A solution would be to add a version status in the query, but this does not hide the fact that "assigned" should be linked to the node, not the version.
Ideas
Have unversioned dynamic attributes linked directly to the node for status/flags/etc:
d_assigned = versioned dynamic attribute (text)
n_assigned = node attribute (varchar)
cannot use negative clauses
Find all the tasks assigned to nobody: tasks in site where d_assigned is null. This will fail as it will find any node with a version not having d_assigned, or any node that has another dynamic attributes as 'assigned'.
This is wrong (see attached file for db example):
select nodes.name from nodes, attributes where not (attributes.node_id = nodes.id and attributes.key = 'assigned')
This does not work either:
select nodes.name from nodes left join attributes on attributes.node_id = nodes.id where attributes.key is NULL or attributes.key 'assigned'
This works:
select nodes.name from nodes where nodes.id not in (select attributes.node_id from attributes where attributes.key = 'assigned')
Trac Attachments
http://dev.zenadmin.org:80//atta...
Trac Comments
2008-05-11 22:25:49 changed by gaspard
attachment tests_dump.sql added.
attachment tests_dump.sql added.
2008-05-11 22:26:26 changed by gaspard
description changed.
description changed.
2008-05-11 22:35:06 changed by gaspard
estimatedhours set to 10.
description changed.
milestone set to hard_to_fix.
estimatedhours set to 10.
description changed.
milestone set to hard_to_fix.
2008-05-11 22:37:32 changed by gaspard
The query would be in zena:
SELECT DISTINCT nodes.name FROM nodes,versions,dyn_attributes WHERE nodes.parent_id = 11 AND versions.id NOT IN (select owner_id from dyn_attributes where key = 'assigned') AND nodes.id = versions.node_id
2008-05-12 10:31:19 changed by gaspard
To use "node" tags such as "assigned", it is better to do this with relations and set a default link to a contact "nobody" (zip=23):
And then: to find all tasks not assigned (assigned to nobody).
No comments found
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Anyone knows how to use formatting here ?
Git repository: http://github.com/zena
Official website: http://zenadmin.org