Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Constants used across the application

# Points awarded for each Linear priority level
# priority: score
# Priority levels:
# 1 = Urgent
# 2 = High
# 3 = Medium
# 4 = Low
# 5 = Very Low
PRIORITY_TO_SCORE = {1: 10, 2: 10, 3: 5, 4: 1, 5: 1}
3 changes: 2 additions & 1 deletion jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
get_stale_issues_by_assignee,
)
from openai_client import get_chat_function_call
from constants import PRIORITY_TO_SCORE

load_dotenv()

Expand Down Expand Up @@ -144,7 +145,7 @@ def post_leaderboard():
+ get_completed_issues(5, "New Feature", 7)
+ get_completed_issues(5, "Technical Change", 7)
)
priority_to_score = {1: 10, 2: 10, 3: 5, 4: 1, 5: 1}
priority_to_score = PRIORITY_TO_SCORE
leaderboard = {}
for item in items:
assignee = item["assignee"]
Expand Down
4 changes: 2 additions & 2 deletions linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from gql.transport.aiohttp import AIOHTTPTransport

from config import get_platforms
from constants import PRIORITY_TO_SCORE

load_dotenv()

Expand Down Expand Up @@ -280,8 +281,7 @@ def by_assignee(issues):
assignee_issues[assignee] = {"score": 0, "issues": []}
assignee_issues[assignee]["issues"].append(issue)
# high - 10, medium - 5, everything else - 1
priority_to_score = {1: 10, 2: 10, 3: 5, 4: 1, 5: 1}
score = priority_to_score.get(issue["priority"], 1)
score = PRIORITY_TO_SCORE.get(issue["priority"], 1)
assignee_issues[assignee]["score"] += score
# sort by the score
return dict(
Expand Down