Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot properly assign to person #1284

Open
2 of 4 tasks
ZionDeng opened this issue Jan 27, 2022 · 1 comment · May be fixed by #1301
Open
2 of 4 tasks

Cannot properly assign to person #1284

ZionDeng opened this issue Jan 27, 2022 · 1 comment · May be fixed by #1301

Comments

@ZionDeng
Copy link

ZionDeng commented Jan 27, 2022

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?

  • 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
  • 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

@tvarney
Copy link

tvarney commented Mar 3, 2022

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 added a commit to tvarney/jira-1 that referenced this issue Mar 3, 2022
This adds a parameter to the `_get_user_id()` method which allows for
selectively disabling the search for the user that said method performs.
This allows for code to perform it's own user search prior to calling
methods which use this method (e.g. `assign_issue`). This fixes an issue
where the search would return the wrong user due to the ordering of
users, and prevents the code from issuing duplicate search calls to the
Jira server when the user has already done so.

Closes pycontribs#1284
tvarney added a commit to tvarney/jira-1 that referenced this issue Mar 3, 2022
This adds a parameter to the `_get_user_id()` method which allows for
selectively disabling the search for the user that said method performs.
This allows for code to perform it's own user search prior to calling
methods which use this method (e.g. `assign_issue`). This fixes an issue
where the search would return the wrong user due to the ordering of
users, and prevents the code from issuing duplicate search calls to the
Jira server when the user has already done so.

Closes pycontribs#1284
@tvarney tvarney linked a pull request Mar 3, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants