Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#13456 closed defect (worksforme)

Not working for Trac 1.2

Reported by: anonymous Owned by: Franz
Priority: normal Component: BudgetingPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.2

Description (last modified by Jun Omae)

I used the budgeting plugin 0.5.a4 in trac v0.12 and below. After switching to trac 1.2 ether 0.5.a4 nor 0.6 works. The module egg can be installed and is correctly listed in the admin moduls section of trac. ticketbudgeting.ticketbudgeting.TicketBudgetingView = enabled is inserted in trac.ini. When enabled the plugin causes an error on open of any ticket and on creating new ones. You may find the output below. We would be very pleased if you could fix this:

---------------------------------------------------------------------
"/usr/lib/python2.7/dist-packages/trac/web/main.py", Zeile 613, in _dispatch_request
"/usr/lib/python2.7/dist-packages/trac/web/main.py", Zeile 273, in dispatch
"/usr/lib/python2.7/dist-packages/trac/web/chrome.py", Zeile 1123, in render_template
"/usr/lib/python2.7/dist-packages/genshi/core.py", Zeile 133, in __or__
"/usr/lib/python2.7/dist-packages/trac/web/chrome.py", Zeile 1436, in inner
"/usr/local/lib/python2.7/dist-packages/Budgeting_Plugin-0.6.0-py2.6.egg/ticketbudgeting/ticketbudgeting.py", Zeile 288, in filter_stream
"/usr/local/lib/python2.7/dist-packages/Budgeting_Plugin-0.6.0-py2.6.egg/ticketbudgeting/ticketbudgeting.py", Zeile 752, in create_table
"/usr/local/lib/python2.7/dist-packages/Budgeting_Plugin-0.6.0-py2.6.egg/ticketbudgeting/ticketbudgeting.py", Zeile 773, in create_reports 

Attachments (0)

Change History (17)

comment:1 Changed 6 years ago by Jun Omae

Description: modified (diff)
Keywords: not working for trac 1.2 removed
Type: enhancementdefect

comment:2 Changed 6 years ago by Franz

Unfortunately, I do not maintain the plguin anymore. We used it in production with Trac 1.1.1 (database was PostgreSQL) and it worked flawlessly.

It could be possible, that the error occurs, because you use other database as PostgreSQL; I have not tested it with SqLite or such.

comment:3 Changed 6 years ago by Ryan J Ollos

Resolution: worksforme
Status: newclosed

Please install the latest, 0.6.6, from trunk. It works correctly for me with Trac 1.2-stable.

Last edited 6 years ago by Ryan J Ollos (previous) (diff)

comment:4 Changed 6 years ago by anonymous

Resolution: worksforme
Status: closedreopened

I had a try. Although you don't maintain this project anymore you maybe got a hint/tip for me. Thanks in advance. So here is all I did:

  • Removed all "old" Budgeting information from trac.ini
    root@xxxx:/# rm -rf /usr/local/lib/python2.7/dist-packages/Budgeting_Plugin-0.5.a4-py2.6.egg
    root@xxxx:/# apachectl restart
     * Made an egg from the new one
    root@xxxx:/tmp/trunk# python setup.py bdist_egg
    
  • Installed the egg via Trac Webinterface and checked the path and enabled status
    root@xxxx:/# locate Budgeting
    /usr/local/lib/python2.7/dist-packages/Budgeting_Plugin-0.6.0-py2.6.egg
    
  • Checked the trac.ini
    ticketbudgeting.ticketbudgeting.ticketbudgetingpermission = enabled
    ticketbudgeting.ticketbudgeting.ticketbudgetingview = enabled
    
  • Inserted my old plugin configs to trac.ini
    [budgeting-plugin]
    default_cost = 0
    types = Doku|Impl|Info|Spezi|Test
    default_cost = 2.0
    default_estimation = 2.0
    default_state = 0
    default_type = Impl
    
  • Noticed that "old" values from version 0.5a4 needed to be changed to integers (This is correctly done by installation but I overwrote them unintentional.)
    default_cost = 2
    default_estimation = 2
    
  • Then all errors disappeared. But there is still no budgeting information in my tickets.
  • I noticed a new report "{90} report_title_90" was created in tickets, containing:
    SELECT t.id, t.summary,
                       t.milestone AS __group__, '../milestone/' ||
                       t.milestone AS __grouplink__, t.owner, t.reporter,
                       t.status, t.type, t.priority, t.component,
                       COUNT(b.ticket) AS Count, SUM(b.cost) AS Cost,
                       SUM(b.estimation) AS Effort,
                       CAST(AVG(b.status) AS integer) || '%' AS "Status",
              (CASE
                WHEN t.status='closed'
                THEN 'color: #777; background: #ddd; border-color: #ccc;'
                WHEN SUM(b.cost) > SUM(b.estimation)
                THEN 'font-weight: bold; background: orange;'
               END) AS __style__
             FROM ticket t
             LEFT JOIN budgeting b ON b.ticket = t.id
             WHERE t.milestone LIKE
             (CASE $MILESTONE
                       WHEN '' THEN '%'
                       ELSE $MILESTONE END) and
             (t.component LIKE (CASE $COMPONENT
                       WHEN '' THEN '%'
                       ELSE $COMPONENT END) or t.component is null) and
             (t.owner LIKE (CASE $OWNER
                       WHEN '''' THEN $USER
                       ELSE $OWNER END) or t.owner is null or
              b.username LIKE (CASE $OWNER
                       WHEN '''' THEN $USER
                       ELSE $OWNER END) )
             GROUP BY t.id, t.type, t.priority, t.summary, t.owner, t.reporter,
                      t.component, t.status, t.milestone
             HAVING COUNT(b.ticket) > 0
             ORDER BY t.milestone DESC, t.status, t.id DESC
    
  • This report throws an error:
    "Warning: Following arguments are missing: MILESTONE, COMPONENT, OWNER"
    
  • Even after adding a new component, milestone and ticket there is no budgeting information anywhere.

comment:5 Changed 6 years ago by Franz

Well, the message "Warning: Following arguments are missing: MILESTONE, COMPONENT, OWNER" is just a hint, no error. When no values are entered for this fields (columns) all rows are displayed.

The report will only display tickets with a budgeting row. So if you have no tickets with any budgeting, it won't show anything.

comment:6 Changed 6 years ago by anonymous

Thats clear but as I wrote above there are no budgeting fields in my tickets where I could enter some information. The fields displayed in the further versions do not appear. Is there any possibility to do a deeper check on that?

comment:7 Changed 6 years ago by anonymous

You should check, if the plugin is enabled in your admin view.

Furthermore you could check Ryan's version, see comment:3.

comment:8 Changed 6 years ago by Ryan J Ollos

Resolution: worksforme
Status: reopenedclosed

Use version 0.6.6, not 0.6.0.

Version 0, edited 6 years ago by Ryan J Ollos (next)

comment:9 Changed 6 years ago by Ryan J Ollos

In 17243:

Change plugin name to TracBudgeting

This prepares for publishing to pypi.

Refs #13456.

comment:10 Changed 6 years ago by Ryan J Ollos

The plugin has been published to pypi:TracBudgeting.

You can get the egg from PyPI if you want to upload through Trac's web interface.

Last edited 6 years ago by Ryan J Ollos (previous) (diff)

comment:11 Changed 6 years ago by anonymous

Hy Ryan, thanks for your effort! It's working as expected now! One last question: In former times the budgeting database query was run with a selection on the logged in user. I had some tries but could not get it to work. Where do I need to enter this selection? Thank you!

SELECT t.id, t.summary,
                   t.milestone AS __group__, '../milestone/' ||
                   t.milestone AS __grouplink__, t.owner, t.reporter,
                   t.status, t.type, t.priority, t.component,
                   COUNT(b.ticket) AS Count, SUM(b.cost) AS Cost,
                   SUM(b.estimation) AS Effort,
                   CAST(AVG(b.status) AS integer) || '%' AS "Status",
          (CASE
            WHEN t.status='closed'
            THEN 'color: #777; background: #transparent; border-color: #ccc;'
            WHEN SUM(b.cost) > SUM(b.estimation)
            THEN 'font-weight: bold; background: orange;'
           END) AS __style__
         FROM ticket t
         LEFT JOIN budgeting b ON b.ticket = t.id
         WHERE t.milestone LIKE
         (CASE $MILESTONE
                   WHEN '' THEN '%'
                   ELSE $MILESTONE END) and
         (t.component LIKE (CASE $COMPONENT
                   WHEN '' THEN '%'
                   ELSE $COMPONENT END) or t.component is null) and
         (t.owner LIKE (CASE $OWNER
                   WHEN '''' THEN $USER
                   ELSE $OWNER END) or t.owner is null or
          b.username LIKE (CASE $OWNER
                   WHEN '''' THEN $USER
                   ELSE $OWNER END) )
         GROUP BY t.id, t.type, t.priority, t.summary, t.owner, t.reporter,
                  t.component, t.status, t.milestone
         HAVING COUNT(b.ticket) > 0
         ORDER BY t.milestone DESC, t.status, t.id DESC

comment:12 Changed 6 years ago by Franz

The user is label as OWNER. This has been ever since.

It should however uses the logged in user, if nothing has been set for OWNER. But as I see in your code this should be done by these lines:

(CASE $OWNER
                   WHEN '''' THEN $USER
                   ELSE $OWNER END)

comment:13 Changed 6 years ago by anonymous

Thanks Franz! As I'm not used to this all my tries result in errors. So where do I have to insert these lines exactly/can you update my code? Thanks a lot!

comment:14 Changed 6 years ago by Franz

Judging your code from comment:11, it should already be present.

comment:15 Changed 6 years ago by anonymous

Awfully it's not. As I wrote above when opening report 90 I got "Warning: Following arguments are missing: MILESTONE, COMPONENT, OWNER". So the report query does not fetch the current logged in user. My intention is to see the budgeting report for the logged in user/owner on click of the report. My users don't like to enter the owner everytime. Thanks!

comment:16 Changed 6 years ago by Franz

Well, this might just a minor flaw in Trac Core, in report view or in the SQL.

If OWNER is empty it will use the login name, but it does not show it in your arguments and thus displays a warning.

comment:17 Changed 6 years ago by anonymous

I think in Trac 1.3.1+ you can specify defaults like -- OWNER=$USER to avoid this: t:ticket:11837

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Franz.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.