-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
748 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import datetime as d | ||
import numpy as np | ||
|
||
ymd_create = [] | ||
ymd_resdate = [] | ||
delta_t = [] | ||
|
||
class calculate: | ||
def __init__(self): | ||
self.result = 0 | ||
|
||
def meantime(self, issueobject): | ||
for i in range(0, len(issueobject)): | ||
ymd_create.append(d.datetime(int(issueobject[i].raw[u'fields'][u'created'].split('T')[0].split('-')[0]), int(issueobject[i].raw[u'fields'][u'created'].split('T')[0].split('-')[1]), int(issueobject[i].raw[u'fields'] | ||
[u'created'].split('T')[0].split('-')[2]), int(issueobject[i].raw[u'fields'][u'created'].split('T')[1].split(':')[0]), int(issueobject[i].raw[u'fields'][u'created'].split('T')[1].split(':')[1]))) | ||
ymd_resdate.append(d.datetime(int(issueobject[i].raw[u'fields'][u'resolutiondate'].split('T')[0].split('-')[0]), int(issueobject[i].raw[u'fields'][u'resolutiondate'].split('T')[0].split('-')[1]), int(issueobject[i].raw[u'fields'] | ||
[u'resolutiondate'].split('T')[0].split('-')[2]), int(issueobject[i].raw[u'fields'][u'resolutiondate'].split('T')[1].split(':')[0]), int(issueobject[i].raw[u'fields'][u'resolutiondate'].split('T')[1].split(':')[1]))) | ||
delta_t.append((ymd_resdate[i] - ymd_create[i]).days) | ||
|
||
self.result = np.mean(np.array(delta_t)) | ||
return self.result | ||
|
||
def mediantime(self, issueobject): | ||
for i in range(0, len(issueobject)): | ||
ymd_create.append(d.datetime(int(issueobject[i].raw[u'fields'][u'created'].split('T')[0].split('-')[0]), int(issueobject[i].raw[u'fields'][u'created'].split('T')[0].split('-')[1]), int(issueobject[i].raw[u'fields'] | ||
[u'created'].split('T')[0].split('-')[2]), int(issueobject[i].raw[u'fields'][u'created'].split('T')[1].split(':')[0]), int(issueobject[i].raw[u'fields'][u'created'].split('T')[1].split(':')[1]))) | ||
ymd_resdate.append(d.datetime(int(issueobject[i].raw[u'fields'][u'resolutiondate'].split('T')[0].split('-')[0]), int(issueobject[i].raw[u'fields'][u'resolutiondate'].split('T')[0].split('-')[1]), int(issueobject[i].raw[u'fields'] | ||
[u'resolutiondate'].split('T')[0].split('-')[2]), int(issueobject[i].raw[u'fields'][u'resolutiondate'].split('T')[1].split(':')[0]), int(issueobject[i].raw[u'fields'][u'resolutiondate'].split('T')[1].split(':')[1]))) | ||
delta_t.append((ymd_resdate[i] - ymd_create[i]).days) | ||
|
||
self.result = np.median(np.array(delta_t)) | ||
return self.result | ||
|
||
def variancetime(self, issueobject): | ||
for i in range(0, len(issueobject)): | ||
ymd_create.append(d.datetime(int(issueobject[i].raw[u'fields'][u'created'].split('T')[0].split('-')[0]), int(issueobject[i].raw[u'fields'][u'created'].split('T')[0].split('-')[1]), int(issueobject[i].raw[u'fields'] | ||
[u'created'].split('T')[0].split('-')[2]), int(issueobject[i].raw[u'fields'][u'created'].split('T')[1].split(':')[0]), int(issueobject[i].raw[u'fields'][u'created'].split('T')[1].split(':')[1]))) | ||
ymd_resdate.append(d.datetime(int(issueobject[i].raw[u'fields'][u'resolutiondate'].split('T')[0].split('-')[0]), int(issueobject[i].raw[u'fields'][u'resolutiondate'].split('T')[0].split('-')[1]), int(issueobject[i].raw[u'fields'] | ||
[u'resolutiondate'].split('T')[0].split('-')[2]), int(issueobject[i].raw[u'fields'][u'resolutiondate'].split('T')[1].split(':')[0]), int(issueobject[i].raw[u'fields'][u'resolutiondate'].split('T')[1].split(':')[1]))) | ||
delta_t.append((ymd_resdate[i] - ymd_create[i]).days) | ||
|
||
self.result = np.var(np.array(delta_t)) | ||
return self.result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from openpyxl import load_workbook | ||
import re | ||
import jira | ||
from jira import JIRA | ||
import sys | ||
import os | ||
import tkinter.filedialog | ||
|
||
|
||
# Jira Server Connection | ||
options = { | ||
'server': 'YOUR_DOMAIN'} | ||
# Auth | ||
try: | ||
jira = JIRA(options, basic_auth=('JIRA_USER_NAME', 'JIRA_PASSWORD')) | ||
except BaseException as Be: | ||
print(Be) | ||
props = jira.application_properties() | ||
|
||
|
||
regex = re.compile(r'^.*?(?=@)') | ||
|
||
|
||
user_input = tkinter.filedialog.askopenfilename() | ||
if os.path.exists(user_input): | ||
workbook = load_workbook(user_input) | ||
else: | ||
assert os.path.exists( | ||
user_input), "File couldn't be found at, "+str(user_input) | ||
|
||
|
||
first_sheet = workbook.get_sheet_names()[0] | ||
worksheet = workbook.get_sheet_by_name(first_sheet) | ||
|
||
names = [] | ||
emails = [] | ||
usernames = [] | ||
|
||
i = 0 | ||
for row in worksheet.iter_rows(): | ||
if row[0].row > 1: | ||
names.append(row[1].value) | ||
emails.append(row[2].value) | ||
usernames.append(row[1].value.lower().replace(' ','.')) | ||
try: | ||
jira.add_user(usernames[i], emails[i], directoryId=1, password=None, | ||
fullname=names[i], notify=True, active=True, ignore_existing=True) | ||
except BaseException as Be: | ||
print ('User Already Exists! : ',usernames[i]) | ||
# print(Be) | ||
try: | ||
jira.add_user_to_group(usernames[i], 'USER_GROUP') | ||
except BaseException as Be: | ||
print (Be) | ||
print ('User added: ',usernames) | ||
i += 1 |
Oops, something went wrong.