Hi Dave,

Thank you for the information. I'll try it again and let you know

Regards!
Deshani

On Fri, Mar 16, 2018 at 2:52 AM, Dave Brondsema <d...@brondsema.net> wrote:

> Hi,
>
> Your changes look ok just reading them.  What happens when you try it?  Do
> you
> get any error?
>
> One thought is that bulk edit happens as a background task (because
> updating
> hundreds of tickets could take some time).  Specifically @task bulk_edit
> is what
> calls Globals.update_tickets  So make sure you have taskd running.  And if
> it is
> running, check to see if bulk_edit task runs and if it has any errors.
>
> Hope that helps,
>
> On 3/15/18 9:22 AM, Deshani Geethika wrote:
> > Hi all,
> >
> > During last few days, I’ve been playing with Allura code-base and started
> > to work on the issue #8149 Bulk Delete for tickets (
> > https://forge-allura.apache.org/p/allura/tickets/8149/)
> >
> > I have modified the file
> > ‘ForgeTracker/forgetracker/templates/tracker_widgets/
> mass_edit_form.html’
> > and added the following set of lines, which is similar to ‘Private’ field
> > with just boolean values.
> >
> > ………...
> >
> > <div class="grid-6">
> >
> >      <label for="deleted" class="cr">Delete:</label>
> >
> >      <select name="deleted" id="deleted">
> >
> >            <option value="" selected="selected">Don't change</option>
> >
> >            <option value="True">True</option>
> >
> >            <option value="False">False</option>
> >
> >      </select>
> >
> > </div>
> >
> > ………...
> >
> > Then, in ‘model/ticket.py’, class ‘Globals’, method ‘update_tickets’, I
> > have added following set of lines.
> >
> > ……...
> >
> > private = post_data.get('private')
> >
> > if private:
> >
> >        values['private'] = asbool(private)
> >
> > deleted = post_data.get('deleted')
> >
> > if deleted:
> >
> > values['deleted'] = asbool(deleted)
> >
> > ……...
> >
> > Here, the value of ‘deleted’, which is submitted from
> ‘mass_edit_form.html’
> > is read and saved to ‘values’ dictionary.
> >
> > Then in the same method, as far as I understood, I have to add the
> > functionality for mass delete. Also, I’ve found out the ‘delete’ method
> > which is implemented to delete a single ticket in
> > ‘ForgeTracker/forgetracker/tracker_main.py’
> > class.
> >
> > Therefore, I have imported the ‘delete’ method from above class, and use
> > that method directly to delete tickets one by one (inside the tickets
> loop)
> > as below. I’ve assumed that, if a user needs to delete tickets, then
> other
> > fields (Private, Owner, Discussion Disabled etc.) are not required to be
> > modified. So that, if a ticket is deleted, the loop breaks without
> further
> > modifying the ticket.
> >
> > …..
> >
> > def update_tickets(self, **post_data):
> >
> >        from forgetracker.tracker_main import get_change_text, get_label,
> > delete
> >
> > ……….
> >
> > for ticket in tickets:
> >
> >   message = ''
> >
> >   if labels:
> >
> >         values['labels'] = self.append_new_labels(
> >
> >             ticket.labels, labels.split(','))
> >
> >        for k, v in sorted(values.iteritems()):
> >
> >        if k == 'deleted':
> >
> >                  if v:
> >
> >                  ticket.delete()
> >
> >             break
> >
> >            elif k == 'assigned_to_id':
> >
> >                    new_user = User.query.get(_id=v)
> >
> >                    old_user = User.query.get(_id=getattr(ticket, k))
> >
> >                    if new_user:
> >
> >                        message += get_change_text(
> >
> >                                get_label(k),
> >
> >                                new_user.display_name,
> >
> >                                old_user.display_name)
> >
> >
> >
> >            elif k == 'private' or k == 'discussion_disabled':
> >
> >                 def _text(val):
> >
> >                        if val:
> >
> >                            return 'Yes'
> >
> >                        else:
> >
> >                            return 'No'
> >
> >            message += get_change_text(
> >
> >                        get_label(k),
> >
> >                        _text(v),
> >
> >                        _text(getattr(ticket, k)))
> >
> >            else:
> >
> >                  message += get_change_text(
> >
> >                            get_label(k),
> >
> > v,getattr(ticket, k))
> >
> > setattr(ticket, k, v)
> >
> > ……….
> >
> > But, the mass delete functionality is not working and I’m not sure
> whether
> > I’m on the right path. Could you help me to solve this issue.
> >
> > Regards!
> >
> > Deshani
> >
> > On Fri, Mar 9, 2018 at 10:46 PM, Deshani Geethika <
> deshanigeeth...@gmail.com
> >> wrote:
> >
> >> Hi Dave,
> >>
> >> Thank you for your guidance. I'll get back if I get anything to be
> >> clarified
> >>
> >> Regards!
> >> -Deshani
> >>
> >> On Fri, Mar 9, 2018 at 9:55 PM, Dave Brondsema <d...@brondsema.net>
> wrote:
> >>
> >>> Hi Deshani,
> >>>
> >>> Welcome!  Sounds like you're off to a good start.  I would suggest
> getting
> >>> familiar with the codebase of Allura would be a good next step.
> >>> https://forge-allura.apache.org/docs/development/contributing.html
> >>> explains some
> >>> of the basics and is a good read.  If there are small changes you want
> to
> >>> make
> >>> (whether related to a larger GSoC task or not) you could try to make
> >>> them.  Feel
> >>> free to ask for help here, or if you make a small fix or improvement,
> go
> >>> ahead
> >>> and submit a merge request :)
> >>>
> >>> -Dave
> >>>
> >>> On 3/9/18 12:48 AM, deshanigeeth...@gmail.com wrote:
> >>>> Hi all,
> >>>>
> >>>> I’m Deshani Geethika, a final year undergraduate at Department of
> >>> Computer Science and Engineering, University of Moratuwa, Sri Lanka. I
> >>> would like to participate in GSoC 2018 and I found out some interesting
> >>> projects of Apache Allura.
> >>>>
> >>>> I have gone through the documentation and set up Allura in my local
> >>> machine. Also, I wrote a blog article (https://medium.com/@deshanige
> >>> ethika/in-progress-setting-up-apache-allura-in-ubuntu-1fa166406448)
> >>> about setting up Allura.
> >>>>
> >>>> Since I’m new to this community, it is really appreciated if  anyone
> >>> suggest me a way to begin contributing to Allura.
> >>>>
> >>>> Regards!
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> Dave Brondsema : d...@brondsema.net
> >>> http://www.brondsema.net : personal
> >>> http://www.splike.com : programming
> >>>               <><
> >>>
> >>
> >>
> >
>
>
>
> --
> Dave Brondsema : d...@brondsema.net
> http://www.brondsema.net : personal
> http://www.splike.com : programming
>               <><
>

Reply via email to