Skip to content

Instantly share code, notes, and snippets.

@sebkouba
Created December 14, 2016 10:24
Show Gist options
  • Save sebkouba/31dd4ce74a388d34601bf246de057c92 to your computer and use it in GitHub Desktop.
Save sebkouba/31dd4ce74a388d34601bf246de057c92 to your computer and use it in GitHub Desktop.
Delete jira worklogs by one user on particular day
# -*- coding: utf-8 -*-
from jira import JIRA
jira = JIRA(server="http://something.com/", basic_auth=('user', 'password'))
query = "worklogdate = 2016-11-30 and worklogauthor = vfprelea"
relevant_issues = jira.search_issues(query, maxResults=50)
while relevant_issues:
for issue in relevant_issues:
for worklog in jira.worklogs(issue):
if worklog.started.startswith("2016-11-30") and worklog.author.name == "vfprelea":
# print(issue.fields.summary)
print("Worklog started: " + worklog.started + " by: " + worklog.author.name)
worklog.delete(adjustEstimate="leave")
# if issues remain they are found here
relevant_issues = jira.search_issues(query, maxResults=50)
print("done")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment