fixed bugs, removed dependencies from requirements

This commit is contained in:
Michał Kalinowski
2024-10-17 09:15:02 +02:00
parent a9fd9a95d8
commit 3ef1e18c4e
4 changed files with 13 additions and 6 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.venv/ .venv/
.env .env
.env_demo
*.crt *.crt

View File

@@ -7,4 +7,5 @@
the root certificate into the repository. Make sure the name in the root certificate into the repository. Make sure the name in
the global varialbes is correct. the global varialbes is correct.
4. Generate the Personal Access Token in Jira 4. Generate the Personal Access Token in Jira
5. Edit the global variables to configure your script. 5. Setup a .env file with a format: TOKEN=personal_access_token (put your own token)
6. Edit the global variables to configure your script.

15
main.py
View File

@@ -1,11 +1,14 @@
import requests import requests
import json import json
import datetime import datetime
from dotenv import load_dotenv
from os import getenv
ACCESS_TOKEN = "" # Modify load_dotenv()
ACCESS_TOKEN = getenv("TOKEN")
USERNAMES = ["kalinom6"] # Modify USERNAMES = ["kalinom6"] # Modify
URL = "https://globaljira.roche.com/rest/api/2" URL = "https://globaljira.roche.com/rest/api/2"
CERT = 'Roche G3 Root CA.crt' CERT = getenv("CERT_LOCATION")
WEEKS_BACK = 1 WEEKS_BACK = 1
VERBOSE = True VERBOSE = True
@@ -53,6 +56,7 @@ def get_worklogs(issues):
for log in data.get("worklogs", []): for log in data.get("worklogs", []):
worklog = { worklog = {
"ticket_id": issue["task_id"], "ticket_id": issue["task_id"],
"jira_link": issue["task_link"],
"time_spent": log["timeSpent"], "time_spent": log["timeSpent"],
"date": log["started"], "date": log["started"],
"author": log["author"]["name"] "author": log["author"]["name"]
@@ -73,6 +77,7 @@ def get_days(day, weeks_back=WEEKS_BACK):
days.append(str(day)) days.append(str(day))
return days return days
# NOT FUNCTIONAL
def get_weeks(day, worklogs, weeks=list()): def get_weeks(day, worklogs, weeks=list()):
year, weeknum, day_of_week = day.isocalendar() year, weeknum, day_of_week = day.isocalendar()
days = get_days(day, weeks_back=0) days = get_days(day, weeks_back=0)
@@ -83,9 +88,9 @@ def get_weeks(day, worklogs, weeks=list()):
get_weeks(days[0], worklogs, weeks) get_weeks(days[0], worklogs, weeks)
return weeks return weeks
# TODO: implement this
def get_days_range(date_from, date_to):
pass
def get_week_tickets(worklogs, days): def get_week_tickets(worklogs, days):
this_week_tickets = [] this_week_tickets = []

Binary file not shown.