Skip to content

Commit

Permalink
feat: add repository count
Browse files Browse the repository at this point in the history
  • Loading branch information
devfle committed Oct 11, 2023
1 parent d1647fe commit 177907e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions graphql_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
followers {{
totalCount
}}
RepositoryConnection {{
totalCount
}}
}}
}}
"""
5 changes: 4 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"<pre>💪 1x contribute → { contribution_ep } experience points\n"
f"🌟 1x follower → { follower_ep } experience points</pre>\n")
f"🌟 1x follower → { follower_ep } experience points\n"
f"📁 1x repository → { project_ep } experience points</pre>\n")

return (f"{start_section}\n"
f"{ getenv('INPUT_CARD_TITLE') if getenv('INPUT_CARD_TITLE') else '' } \n"
Expand Down
12 changes: 11 additions & 1 deletion readme_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit 177907e

Please sign in to comment.