Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Commit

Permalink
Add path under kebechet-update-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
xtuchyna committed Feb 19, 2021
1 parent 577ba97 commit 10075a5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions srcopsmetrics/kebechet_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import pandas as pd
from github import Github

from srcopsmetrics import utils
from srcopsmetrics.entities.issue import Issue
from srcopsmetrics.entities.pull_request import PullRequest
from srcopsmetrics.storage import KnowledgeStorage
Expand All @@ -42,6 +43,7 @@

_LOGGER = logging.getLogger(__name__)
_GITHUB_ACCESS_TOKEN = os.getenv("GITHUB_ACCESS_TOKEN")
_ROOT_DIR = "kebechet-update-manager"


class KebechetMetrics:
Expand Down Expand Up @@ -204,13 +206,16 @@ def evaluate_and_store_kebechet_metrics(self, is_local: bool):
for get_stats in [self.update_manager]:
stats = get_stats()

path = f"./srcopsmetrics/metrics/{self.repo_name}/kebechet_{get_stats.__name__}"
path = Path(f"./{_ROOT_DIR}/{self.repo_name}/")
utils.check_directory(path)

file_name = f"kebechet_{get_stats.__name__}"
if self.today:
curr_day = datetime.now().date()
path += f"_{str(curr_day)}"
path += ".json"
file_name += f"_{str(curr_day)}"
file_name += ".json"

KnowledgeStorage(is_local=is_local).save_knowledge(file_path=Path(path), data=stats)
KnowledgeStorage(is_local=is_local).save_knowledge(file_path=path.joinpath(file_name), data=stats)

def update_manager(self):
"""Calculate and store update manager metrics."""
Expand Down

0 comments on commit 10075a5

Please sign in to comment.