Edgewall Software
Modify

Ticket #9718 (closed defect: fixed)

Opened 19 months ago

Last modified 19 months ago

[PATCH] rounding error can corrupt progress bar in milestone_view

Reported by: Andrew C Martin <andrew.c.martin@…> Owned by: Andrew C Martin <andrew.c.martin@…>
Priority: normal Milestone: 0.12.2
Component: roadmap Version: 0.12dev
Severity: normal Keywords: progressbar roadmap milestone
Cc:
Release Notes:
API Changes:

Description

Note the progress bar in the bottom right corner of this image:


Despite the fact that there are zero closed tickets, the progress bar shows ~100% are.

If you look at the HTML generated below, you can see that the first TD is getting a negative width. It should actually show "display: none" since there are no "closed" tickets. IE/Chrome/FF all interpret the negative width as ~100% width:

  <table class="progress" style="width: 80%">
    <tr>
      <td class="closed" style="width: -1%">
        <a href="/test/query?status=closed&amp;group=status&amp;type=defect&amp;milestone=milestone1" title="0/8 closed"></a>
      </td><td class="new" style="width: 13%">
        <a href="/test/query?status=new&amp;group=status&amp;type=defect&amp;milestone=milestone1" title="1/8 new"></a>
      </td><td class="open" style="width: 88%">
        <a href="/test/query?status=assigned&amp;status=accepted&amp;status=reopened&amp;group=status&amp;type=defect&amp;milestone=milestone1" title="7/8 in progress"></a>

      </td>
    </tr>
  </table>

I am proposing attachment:progress_bar.patch to fix this issue. roadmap.py doesn't handle a boundary case for when the rounded sum of all the percentages can be greater than 100.

This is easy to reproduce:

  1. Fire up a new trac test environment
  2. Append these lines to your trac.ini:
    [milestone-groups]
    closed = closed
    closed.order = 0
    closed.overall_completion = true
    new = new
    new.order = 1
    new.css_class = new
    new.label = new
    new.overall_completion = false
    active = *
    active.order = 2
    active.css_class = open
    active.label = in progress
    
  3. Write 8 tickets and assign all of them to milestone1.
  4. "Accept" all but 1 ticket in the tickets' workflow.
  5. Click on milestone1 from the roadmap.

I think there's an issue with the way that "1 / 8" gets calculated when "overall_completion = false" that may be a separate bug…

Attachments

progress_bar.png (70.0 KB) - added by Andrew C Martin <andrew.c.martin@…> 19 months ago.
progress_bar.patch (2.1 KB) - added by Andrew C Martin <andrew.c.martin@…> 19 months ago.

Download all attachments as: .zip

Change History

Changed 19 months ago by Andrew C Martin <andrew.c.martin@…>

Changed 19 months ago by Andrew C Martin <andrew.c.martin@…>

comment:1 Changed 19 months ago by Andrew C Martin <andrew.c.martin@…>

  • Keywords progressbar roadmap milestone added

comment:2 Changed 19 months ago by rblank

  • Milestone set to 0.12.2
  • Owner set to rblank

Thanks for the patch.

comment:3 in reply to: ↑ description Changed 19 months ago by Andrew C Martin <andrew.c.martin@…>

Replying to Andrew C Martin <andrew.c.martin@…>:

I think there's an issue with the way that "1 / 8" gets calculated when "overall_completion = false" that may be a separate bug…

I wrote #9721 for this issue and proposed a patch for it.

comment:4 Changed 19 months ago by rblank

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

Perfect bug description, perfect patch, applied in [10304]. Thanks!

comment:5 Changed 19 months ago by rblank

  • Owner changed from rblank to Andrew C Martin <andrew.c.martin@…>
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from Andrew C Martin <andrew.c.martin@…>. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.