Skip to content

Commit

Permalink
removed adjustment for watching own repos
Browse files Browse the repository at this point in the history
  • Loading branch information
cicirello committed Dec 1, 2023
1 parent 8bd46ca commit 9534ce7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 62 deletions.
22 changes: 3 additions & 19 deletions src/Statistician.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ def __init__(
fail)
oneYearContribTemplate = self.loadQuery("/queries/singleYearQueryFragment.graphql",
fail)
watchingAdjustmentQuery = self.loadQuery("/queries/watchingAdjustment.graphql",
fail)

reposContributedTo = self.loadQuery("/queries/reposContributedTo.graphql",
fail)

Expand All @@ -104,9 +101,6 @@ def __init__(
self.executeQuery(additionalRepoStatsQuery,
needsPagination=True,
failOnError=fail),
self.executeQuery(watchingAdjustmentQuery,
needsPagination=True,
failOnError=fail),
self.executeQuery(reposContributedTo,
needsPagination=True,
failOnError=fail)
Expand Down Expand Up @@ -152,13 +146,12 @@ def loadQuery(self, queryFilepath, failOnError=True):
set_outputs({"exit-code" : 1})
exit(1 if failOnError else 0)

def parseStats(self, basicStats, repoStats, watchingStats, reposContributedToStats):
def parseStats(self, basicStats, repoStats, reposContributedToStats):
"""Parses the user statistics.
Keyword arguments:
basicStats - The results of the basic stats query.
repoStats - The results of the repo stats query.
watchingStats - The results of the query of repositories the user is watching.
"""
# Extract username (i.e., login) and fullname.
# Name needed for title of statistics card, and username
Expand Down Expand Up @@ -208,7 +201,6 @@ def parseStats(self, basicStats, repoStats, watchingStats, reposContributedToSta

# Reorganize for simplicity
repoStats = list(map(lambda x : x["data"]["user"]["repositories"], repoStats))
watchingStats = list(map(lambda x : x["data"]["user"]["watching"], watchingStats))
reposContributedToStats = list(
map(lambda x : x["data"]["user"]["topRepositories"], reposContributedToStats))

Expand Down Expand Up @@ -286,20 +278,12 @@ def parseStats(self, basicStats, repoStats, watchingStats, reposContributedToSta
watchers = sum(
repo["watchers"]["totalCount"] for page in repoStats if page[
"nodes"] != None for repo in page["nodes"] if not repo["isPrivate"])
watchers -= watchingStats[0]["totalCount"]

if watchingStats[0]["totalCount"] > 0:
watchingMyOwnNonForks = sum(
1 for page in watchingStats if page[
"nodes"] != None for repo in page["nodes"] if not repo["isFork"])
else:
watchingMyOwnNonForks = 0

watchersNonForks = sum(
repo["watchers"]["totalCount"] for page in repoStats if page[
"nodes"] != None for repo in page["nodes"] if not repo[
"isPrivate"] and not repo["isFork"])
watchersNonForks -= watchingMyOwnNonForks


# Count of private repos (not accurate since depends on token used to authenticate query,
# however, all those here are included in count of owned repos.
privateCount = sum(
Expand Down
14 changes: 0 additions & 14 deletions src/queries/watchingAdjustment.graphql

This file was deleted.

Loading

0 comments on commit 9534ce7

Please sign in to comment.