Opened 6 years ago

Closed 6 years ago

# Queue with groups does not work

Reported by: Owned by: gmk@… robguttman high QueuesPlugin major gmk@… 0.12

### Description

group.<action> does not work since there is another structure of the resulting webpage than expected

The operation is assigned to h2.next() but there is some nesting issue: The first group h2 is outsite the result ticket listing table, but any other group ist within the result table enclosed in subsequent tbody tags.

The first operation in this case is assigned to an table tag, the next is assigned to a tbody tag.

The change function uses always the operation assigned to the table.

        <h2 class="report-result">
Triage
<span class="numrows">
(2 matches)
</span>
</h2>
<table class="listing tickets">
<tr class="trac-columns">
<th>
Queue Pos
</th><th>
Ticket
</th><th>
Summary
</th><th>
Type
</th><th>
Priority
</th><th colspan="100">
Owner
</th>
</tr>
<tbody>
<tr class="color3-even">
<td class="queuepos">
</td>
<td class="ticket">
<a title="View ticket" href="/mytrac/ticket/11">#11</a>
</td>
<td class="summary">
<a title="View ticket" href="/mytrac/ticket/11">Some ticket</a>
</td>
</td>
<td class="priority">major
</td>
<td class="owner">user1
</td>
</tr>
<tr class="color5-odd">
<td class="queuepos">
</td>
<td class="ticket">
<a title="View ticket" href="/mytrac/ticket/12">#12</a>
</td>
<td class="summary">
<a title="View ticket" href="/mytrac/ticket/12">Some other ticket</a>
</td>
<td class="type">inquiry
</td>
<td class="priority">trivial
</td>
<td class="owner">user1
</td>
</tr>
</tbody>
<tbody>
<tr class="trac-group">
<th colspan="100">
<h2 class="report-result">
Group1
<span class="numrows">
(1 match)
</span>
</h2>
</th>
</tr>
<tr class="trac-columns">
<th>
Queue Pos
</th><th>
Ticket
</th><th>
Summary
</th><th>
Type
</th><th>
Priority
</th><th colspan="100">
Owner
</th>
</tr>
</tbody>
<tbody>
<tr class="color3-odd">
<td class="queuepos">1
</td>
<td class="ticket">
<a title="View ticket" href="/mytrac/ticket/14">#14</a>
</td>
<td class="summary">
<a title="View ticket" href="/mytrac/ticket/14">More other ticket</a>
</td>
<td class="type">defect
</td>
<td class="priority">major
</td>
<td class="owner">user1
</td>
</tr>
</tbody>
</table>


### comment:1 Changed 6 years ago by robguttman

• Cc gmk@… added; anonymous removed
• Status changed from new to assigned

gmk, thanks for submitting a ticket for this bug. Can you copy here as a comment your exact group definitions in trac.ini? Also, which exact Trac 0,12 version are you using - e.g., Trac 0.12.1? (I may ask to see your report SQL later but may not be needed yet.) Thanks.

### comment:2 follow-up: ↓ 3 Changed 6 years ago by robguttman

And also, what exactly do you mean by "not work"? What behavior are you expecting and what behavior instead are you getting?

### comment:3 in reply to: ↑ 2 Changed 6 years ago by gmk@…

More exact information and my analyze results (if interested in): (relevant Configuration items only)

[ticket-custom]
queuepos = text
queuepos.format = plain
queuepos.label = Queue Pos
queuepos.order = 8
queuepos.value =

[queues]
group.group1 = reorder
group.triage = clear
max_position = 99
reports = 22,23



What is expected:

• reorder the tickets within group group1
• clear order information in group triage

The queues.js produces the correct code:

            var op = 'reorder';
if (name == 'group1'){
op = 'reorder';
}
if (name == 'triage'){
op = 'clear';
}
var tbl = h2.next().attr('op', op);


But in according to the produced report html there exist problems:

            var tbl = h2.next().attr('op', op);


The first assignment of the attribut 'op' goes to the table tag ( First h2.next() references the result table of the report)

The second assignment of the attribut 'op' goes to the (third in this report) tbody tag ( Second h2.next() references the (third) tbody tag within the result table of the report)

Now if the function 'change' (from generated queues.js) is called

    jQuery('.listing.tickets').each(function(){
var op = jQuery(this).attr('op');


'var op' contains the operation from the first h2.next() assignment ('clear' in my case)

Now the code snippet

        jQuery('tbody tr', this).each(function(i){
// check for re-ordered items
...
}


iterates through all rows (ignoring any other groups since they are defined in tbody tags within the result table) and clears all queue positions.

The Report SQL:

SELECT s.value AS __color__,
(CASE p.value
WHEN '' THEN 'Triage'
WHEN NULL THEN 'Triage'
ELSE 'Group1'
END) AS __group__,
p.value as queuepos, t.id AS ticket, summary,
t.type AS type, t.priority, t.owner
FROM ticket t
LEFT JOIN enum s ON s.name = t.priority AND s.type = 'priority'
LEFT OUTER JOIN ticket_custom p ON p.ticket = t.id and p.name = 'queuepos'
WHERE t.status <> 'closed'
ORDER BY (CASE p.value
WHEN '' THEN 'Triage'
WHEN NULL THEN 'Triage'
ELSE Group1 END = 'Triage') DESC,
CAST((CASE p.value
WHEN '' THEN '0'
ELSE COALESCE(p.value,'0') END) AS INTEGER) ASC


I'm not sure how to fix it, and not to break the general idea.

### comment:4 follow-up: ↓ 5 Changed 6 years ago by gmk@…

Will you work on this issue, or should i try to find my own solution. (Just ask to not do double work, since i have to solve it somehow)

Also, may you give me a direction of the basic idea.

best greatings Gernot

### comment:5 in reply to: ↑ 4 ; follow-up: ↓ 6 Changed 6 years ago by anonymous

Will you work on this issue, or should i try to find my own solution. (Just ask to not do double work, since i have to solve it somehow)

Also, may you give me a direction of the basic idea.

best greatings Gernot

I am unable to reproduce your problem. That said, I'm still not sure what your problem is. By "not work" do you mean that tickets cannot be reordered in the 'reorder' group? Are you able to drag tickets at all? Do you see this special message at the top of the report?

This is a special queue report. Drag and drop tickets to their desired position. Select report arguments to the right.


If you don't see the above message then check that the report number is included in the reports option within the [queues] section of trac.ini.

If you do see that message and you can't drag at all, do you see any JS errors? (If you have Firebug installed, that would be particularly helpful to debug.) If no JS errors, it's possible that the problem is some difference between Trac 0.12.1 (which I am using) and Trac 0.12.2. I will try to upgrade to Trac 0.12.2 and see if I can reproduce your problem..

### comment:6 in reply to: ↑ 5 Changed 6 years ago by gmk@…

I am unable to reproduce your problem. That said, I'm still not sure what your problem is. By "not work" do you mean that tickets cannot be reordered in the 'reorder' group?

Yes, it means i cannot reorder in the reorder group (the ordering always gets cleared)

More exact, it does always what the first group is assigned to If first group is for operation clear - all rows in all groups are cleard If first group is for operation reorder - all ros in all groups are reordered

Are you able to drag tickets at all?

Yes

Do you see this special message at the top of the report?

This is a special queue report. Drag and drop tickets to their desired position. Select report arguments to the right.


Yes

regards,

gernot

### comment:7 follow-up: ↓ 8 Changed 6 years ago by robguttman

Ok, good news - I upgraded to Trac 0.12.2 and can now reproduce the problem. Will debug now..

### comment:8 in reply to: ↑ 7 Changed 6 years ago by gmk@…

Ok, good news - I upgraded to Trac 0.12.2 and can now reproduce the problem. Will debug now..

ok, thx

i've also doublechecked now

There is sime difference in the report result table structure: < 0.12.2

<h2>Group0</h2>
<table>rows</table>

<h2>Group1</h2>
<table>rows</table>


0.12.2

<h2>Group0</h2>
<table>
<tbody>rows</tbody>
<tbody><h2>Group0</h2></tbody>
<tbody>rows</tbody>
</table>



May this helps.

### comment:9 Changed 6 years ago by robguttman

Yeah, I got the code working now under 0.12.2 but now I need to figure out how best to support 0.12.1 and 0.12.2 simultaneously..

### comment:10 follow-up: ↓ 12 Changed 6 years ago by gmk@…

great news :)

if i can do something for help, let me know.

### comment:11 Changed 6 years ago by robguttman

(In [9933]) refs #8565: Added Trac 0.12.2 support.

### comment:12 in reply to: ↑ 10 ; follow-up: ↓ 13 Changed 6 years ago by robguttman

if i can do something for help, let me know.

You can help. I just checked in the fix. Can you help test it now? Thanks!

### comment:13 in reply to: ↑ 12 ; follow-up: ↓ 14 Changed 6 years ago by anonymous

if i can do something for help, let me know.

You can help. I just checked in the fix. Can you help test it now? Thanks!

Ordering now works well also with groups. Collapse of groups within the tbody structure does not work

### comment:14 in reply to: ↑ 13 ; follow-up: ↓ 15 Changed 6 years ago by robguttman

Ordering now works well also with groups. Collapse of groups within the tbody structure does not work

Gernot, collapsing is only enabled for clear and ignore groups, not for reorder groups. If they are not working for you for clear and ignore groups, what web browser and version are you using?

### comment:15 in reply to: ↑ 14 ; follow-up: ↓ 16 Changed 6 years ago by gmk@…

Gernot, collapsing is only enabled for clear and ignore groups

Oh yes, sorry ... i was to fast with testing reports.

Works well. (I 've verified it with Chrom, IE8, FireFox 3.6.8 on Windows7 Prof)

### comment:16 in reply to: ↑ 15 Changed 6 years ago by robguttman

• Resolution set to fixed
• Status changed from assigned to closed

Gernot, collapsing is only enabled for clear and ignore groups

Oh yes, sorry ... i was to fast with testing reports.

Works well. (I 've verified it with Chrom, IE8, FireFox 3.6.8 on Windows7 Prof)

Great! And thanks again for submitting this ticket and debug info, and being patient with a fix. Cheers! Closing ticket.