Skip to content

Commit

Permalink
refactor: rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
andylolz committed Jun 10, 2024
1 parent 04cee4d commit f4fc1dd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions x_notes/ratings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
from .helpers import load_notes, save_notes
from .tsv import get_generator

helpfulness_lookup = {"HELPFUL": 2, "SOMEWHAT_HELPFUL": 1, "NOT_HELPFUL": -2}
helpfulness_score = {
"HELPFUL": 2,
"SOMEWHAT_HELPFUL": 1,
"NOT_HELPFUL": -2,
}


def add_ratings(notes: dict[str, dict[str, Any]]) -> None:
Expand All @@ -26,7 +30,7 @@ def add_ratings(notes: dict[str, dict[str, Any]]) -> None:
note["ratings"] = 0
note["score"] = 0
note["ratings"] += 1
note["score"] += helpfulness_lookup[row["helpfulnessLevel"]]
note["score"] += helpfulness_score[row["helpfulnessLevel"]]
index += 1
save_notes(notes)

Expand Down

0 comments on commit f4fc1dd

Please sign in to comment.