From 177907ef5f2540f34689645462413cc66b8fc404 Mon Sep 17 00:00:00 2001 From: devfle <52854338+devfle@users.noreply.github.com> Date: Wed, 11 Oct 2023 16:38:52 +0000 Subject: [PATCH] feat: add repository count --- graphql_query.py | 3 +++ main.py | 5 ++++- readme_level.py | 12 +++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/graphql_query.py b/graphql_query.py index 4dc2eca..ee88059 100644 --- a/graphql_query.py +++ b/graphql_query.py @@ -12,6 +12,9 @@ followers {{ totalCount }} + RepositoryConnection {{ + totalCount + }} }} }} """ diff --git a/main.py b/main.py index 14830f0..a028a9d 100644 --- a/main.py +++ b/main.py @@ -46,10 +46,13 @@ def generate_content(readme_instance: ReadmeLevel, start_section: str, end_secti contribution_ep = readme_instance.get_contribution_ep follower_ep = readme_instance.get_follower_ep + project_ep = readme_instance.get_project_ep + # should be generated in later versions ep_information = (f"
💪 1x contribute → { contribution_ep } experience points\n" - f"🌟 1x follower → { follower_ep } experience points\n") + f"🌟 1x follower → { follower_ep } experience points\n" + f"📁 1x repository → { project_ep } experience points\n") return (f"{start_section}\n" f"{ getenv('INPUT_CARD_TITLE') if getenv('INPUT_CARD_TITLE') else '' } \n" diff --git a/readme_level.py b/readme_level.py index 0dfeec1..3dd52e0 100644 --- a/readme_level.py +++ b/readme_level.py @@ -54,20 +54,30 @@ def calc_current_ep(self) -> int: # calc the current experience points self.current_ep = ( user_stats["totalContributions"] * self.level_data.contribution_ep + - user_stats["totalFollowers"] * self.level_data.follower_ep) + user_stats["totalFollowers"] * self.level_data.follower_ep + + user_stats["totalRepositories"] * self.level_data.project_ep) return self.current_ep + # should be part of data class @property def get_contribution_ep(self) -> int: """gets the contribution ep""" return self.level_data.contribution_ep + + # should be part of data class @property def get_follower_ep(self) -> int: """gets the follower ep""" return self.level_data.follower_ep + # should be part of data class + @property + def get_project_ep(self) -> int: + """gets the project ep""" + return self.level_data.project_ep + @property def get_current_level(self) -> dict[str, int]: """Calculates user level."""