[Cubicweb] Ticket / IProgressAdapter

Carlos Balderas carlos.balderas at gmail.com
Fri Sep 10 04:42:48 CEST 2010

Hello, list

1.- What do you think about making an IProgressAdapter for Ticket entity in
Tracker cube?
     (We find this handy to display progress bar for tickets.)

2.- Would it be so simple like adding these lines in
tracker/entities/ticket.py file?

2.1.- Create the IProgressAdapter

from cubicweb.entities.adapters import IProgressAdapter
from cubicweb.selectors import is_instance

class TicketIProgressAdapter(IProgressAdapter):

    """IProgressAdapter for Tickets """

    __select__ = is_instance('Ticket')

    def progress_info(self):

        """returns a dictionary describing load and progress of the

        return {'notestimated': 0,
                'estimated': 0,
                'done': 0,
                'todo': 0 }

2.2.- Add methods to Ticket Entity

class Ticket(AnyEntity):
    __regid__ = 'Ticket'

--------------------- add these 3 methods ---------------------

    def done(self):

        """returns work done in this ticket """

        return self.load - self.load_left

    def todo(self):

        """returns remaining work in this ticket """

        return self.load_left

    def revised_cost(self):

        """return total work estimated to this ticket """

        return self.load

Making the changes above, the progress bar view works for tickets too, but I
am not sure this is the best way to do it.

Thank you.

Best Regards
Carlos Balderas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20100909/d0557118/attachment-0186.html>

More information about the Cubicweb mailing list