jira icon indicating copy to clipboard operation
jira copied to clipboard

Cannot properly assign to person

Open ZionDeng opened this issue 3 years ago • 1 comments

Bug summary

I am using jira==3.0.1 python package, but I cannot properly assign my created ticket to the person I want. My server is: https://issues.teslamotors.com/

But when I am trying to assign this ticket to him, I got the error error

I am sure that the assignee name is xins, but jira wants to assignee to xinhe

Similar issue goes to soyoujianxins, but leidxu, lifachen, fjin, elliu can be properly assigned.

I think there are some bug in the assign logic, the add watcher function has no similar bugs. I can properly add watchers.

Is there an existing issue for this?

  • [X] I have searched the existing issues

Jira Instance type

Jira Cloud (Hosted by Atlassian)

Jira instance version

No response

jira-python version

3.0.1

Python Interpreter version

3.8

Which operating systems have you used?

  • [ ] Linux
  • [ ] macOS
  • [X] Windows

Reproduction steps

jira : JIRA = JIRA('https://issues.teslamotors.com/', {user}, {password})
issue: Issue = jira.create_issue(
    project = "ACE",
    summary = "VVV.EEE TEST Jira Ticket #COA",
    description = "TEST Jira Ticket for Vendor VVV engineer EEE",
    issuetype = {"name": "Task"},
    components = task["components"]
    components = [],
)
jira.assign_issue(issue.id, 'xins')

Stack trace

![error](https://user-images.githubusercontent.com/47084312/151302613-5ca27bbf-a3de-4e0f-9389-42879d0b90ff.png)

Expected behaviour

Properly assign to the right person

Additional Context

No response

ZionDeng avatar Jan 27 '22 06:01 ZionDeng

My team and I are running into this issue as well, and have spent some time debugging. The issue is that the assign_issue method takes the user argument and performs a search for that user. If the username is contained in any other name, and that name would come first alphabetically, then the _get_user_id() method fails because it takes the first result unconditionally.

E.g. Say we have two users, chris and bchristian and want to assign an issue to chris. When the search for chris is sent to the server by _get_user_id() the first response is for bchristian so _get_user_id() returns that instead of the also valid (and intended!) user ID chris.

tvarney avatar Mar 03 '22 15:03 tvarney