Modify

Opened 4 years ago

Last modified 3 years ago

#6988 reopened enhancement

Using set_owner_to_previous in case reporter and owner are the same

Reported by: anonymous Owned by: retracile
Priority: normal Component: AdvancedTicketWorkflowPlugin
Severity: normal Keywords:
Cc: bof Trac Release: 0.11

Description

I'm using

set_owner_to_reporter
when resolving a ticket, so the reporter has to confirm the resolved ticket.
On confirmation the ticket is closed where I'm using
set_owner_to_previous
in order to close the ticket and to have as owner the one who has resolved the ticket (statistics).
In case that somebody reported a ticket to himself the
set_owner_to_previous
will set the owner empty, as it seems that there were no previous owner as all the time reporter and resolving owner were the same.

Can you please change the set_owner_to_previous to keep the current owner in case there is no previous owner???

Attachments (2)

AdvancedTicketWorkflowPlugin-PreviousOwner.patch (602 bytes) - added by anonymous 4 years ago.
previous owner patch
advancedworkflow-missing-previous-owner.patch (1.3 KB) - added by bof 3 years ago.
fix set_owner_to_previous to use current ticket owner when earlier owner cannot be determined. Fixes both 0.11 and 0.12

Download all attachments as: .zip

Change History (9)

comment:1 Changed 4 years ago by anonymous

Sorry, the idea is wrong, as there is still the possiblity that the ticket was previously reassigned.

Is it possible somehow to get the previous state owner???

comment:2 Changed 4 years ago by anonymous

I have a workaround for now:

Adding a custom field which is filled with resolver name when resolving.
On closing of ticket the owner is set to value of this field.

comment:3 Changed 4 years ago by anonymous

Sorry there is no way to set a custom field to any value automatically, so it would be great if you could introduce such an operation.

Changed 4 years ago by anonymous

previous owner patch

comment:4 Changed 4 years ago by anonymous

I came across this one when a ticket was assigned an owner at creation, therefore ticket_change entry was not created to change the "owner" from the reporter.
Assuming that because the ticket has no previous owner because the has been no ticket_change entry in the database is wrong.
I would consider this a defect not an enhancement.

I've attached a patch that if there is no owner change and there is a current owner then it sets the new owner to current owner, otherwise it deletes the owner.

comment:5 Changed 4 years ago by anonymous

Sorry the patch did not attach correctly, below is the change

Left file: C:\Apps\Python25\Lib\site-packages\advancedworkflow\controller.py.orig
Right file: C:\Apps\Python25\Lib\site-packages\advancedworkflow\controller.py
198c198,205
<             owner = ''
---
>             # Check to see if the ticket has a current owner
>             cursor.execute("SELECT owner FROM ticket WHERE id=%s " \
>                             , (ticket.id, ))
>             row = cursor.fetchone()
>             if row: # Set new owner to current owner
>                 owner = row[0]
>             else: # There has never been an owner
>                 owner = ''

comment:6 Changed 3 years ago by retracile

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

In [9962] I made it fall back to the current owner if there was never a previous setting for the owner. If the previous value of owner was in fact empty, then set_owner_to_previous will still delete the owner. There is a more fundamental issue that if a previous action "set" the owner to the same user as the ticket was already owned by, and the next action is set_owner_to_previous, the owner will be changed to whatever user had it before the current one, which may not be what was desired. I don't see a good answer for that situation; perhaps an implementation of set_owner_to_previous_state_owner would be more robust, but I think that would have odd edge cases as well.

comment:7 Changed 3 years ago by bof

  • Cc bof added
  • Resolution fixed deleted
  • Status changed from closed to reopened

While [9962] fixed the case (in 0.12...) where the ticket started out at creation time with an owner set, and never had a change later, it does not fix the case where the ticket started out unowned and was then accepted exactly once.

In that case, there is a single ticket_change record with oldvalue the empty string.

I will append a patch that handles this situation, by always using ticket[owner] when the database lookup did not find a nonempty oldvalue. The patch also will bring the 0.11 code in line with the 0.12 change.

Changed 3 years ago by bof

fix set_owner_to_previous to use current ticket owner when earlier owner cannot be determined. Fixes both 0.11 and 0.12

Add Comment

Modify Ticket

Action
as reopened .
Author


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

 
Note: See TracTickets for help on using tickets.