Skip to content

Commit

Permalink
adjustments to dash_prime.py (#270)
Browse files Browse the repository at this point in the history
* adjustments to dash_prime.py

* added comment
  • Loading branch information
valaises authored Jan 15, 2024
1 parent edf144b commit e4d00b5
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ def robot_human_ratio(robot: int, human: int) -> float:
return 1
if robot == 0:
return 0
# in older versions of refact LSP negative values of human metric existed
if robot + human == 0:
return 0
return round(robot / (robot + human), 2)


Expand Down Expand Up @@ -181,10 +184,10 @@ def extract_stats(df: pd.DataFrame, date_kind: str) -> Dict:
if lang not in languages:
continue
res_loc[lang] = {
"Assistant": (robot := int(group["robot_characters"].sum())),
"Refact": (robot := int(group["robot_characters"].sum())),
"Human": (human := int(group["human_characters"].sum())),
"Total (characters)": robot + human,
"A/(A+H)": robot_human_ratio(robot, human),
"Refact Impact": robot_human_ratio(robot, human),
"Completions": int(group["completions_cnt"].sum()),
"Users": int(group["tenant_name"].nunique()),
}
Expand All @@ -194,7 +197,7 @@ def extract_stats(df: pd.DataFrame, date_kind: str) -> Dict:
res_loc = {
'data': fmt_vals,
'columns': ['Language', *res_loc[list(res_loc.keys())[0]].keys()],
'title': f"Assistant's impact by language: {date_kind}"
'title': f"Refact's impact by language: {date_kind}"
}
return res_loc

Expand Down

0 comments on commit e4d00b5

Please sign in to comment.