Skip to content

Commit

Permalink
fixed rating bug
Browse files Browse the repository at this point in the history
  • Loading branch information
7h3Rabbit committed Oct 14, 2023
1 parent cd7abd2 commit f4a4bfd
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/css_validator_w3c.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ def create_review_and_rating(errors, _, _local, review_header):

error_message_dict = {}
error_message_grouped_dict = {}
error_message_grouped_for_rating_dict = {}
if number_of_errors > 0:
regex = r"(“[^”]+”)"
for item in errors:
Expand All @@ -438,15 +439,22 @@ def create_review_and_rating(errors, _, _local, review_header):
if not is_whitelisted:
error_message_dict[error_message] = "1"

tmp = re.sub(
regex, "X", error_message, 0, re.MULTILINE)
if css_review_group_errors:
error_message = re.sub(
regex, "X", error_message, 0, re.MULTILINE)
error_message = tmp

if error_message_grouped_dict.get(error_message, False):
error_message_grouped_dict[error_message] = error_message_grouped_dict[error_message] + 1
else:
error_message_grouped_dict[error_message] = 1

if error_message_grouped_for_rating_dict.get(tmp, False):
error_message_grouped_for_rating_dict[tmp] = error_message_grouped_for_rating_dict[tmp] + 1
else:
error_message_grouped_for_rating_dict[tmp] = 1


if len(error_message_grouped_dict) > 0:
error_message_grouped_sorted = sorted(
error_message_grouped_dict.items(), key=lambda x: x[1], reverse=True)
Expand All @@ -460,7 +468,7 @@ def create_review_and_rating(errors, _, _local, review_header):

rating = Rating(_, review_show_improvements_only)

number_of_error_types = len(error_message_grouped_dict)
number_of_error_types = len(error_message_grouped_for_rating_dict)

result = calculate_rating(number_of_error_types, number_of_errors)

Expand Down

0 comments on commit f4a4bfd

Please sign in to comment.