Skip to content

Commit

Permalink
Merge pull request #132 from CDOT-CV/adjust_count_validation
Browse files Browse the repository at this point in the history
Update Email Validation Logic
drewjj authored Dec 31, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 67cef83 + 6dca0ce commit aeb0dec
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions services/addons/images/count_metric/gen_email.py
Original file line number Diff line number Diff line change
@@ -62,13 +62,26 @@ def generate_count_table(rsu_dict, message_type_list):
in_count = value["counts"][type]["in"]
out_count = value["counts"][type]["out"]

# Normalize the diff_percent depending on message types that are deduplicated to 1/hour
x = 3600 if type.lower() == "map" or type.lower() == "tim" else 1
value["counts"][type]["diff_percent"] = (
abs(out_count / -(-(in_count / x) // 1) - 1) * 100
if in_count != 0
else (5 if out_count > in_count else 0)
)
if type.lower() == "bsm" or type.lower() == "tim":
# For unique deduplication situations, don't validate counts unless zero
# Assign the percentage difference between the in and out counts as pass or
# fail since no validation is occurring
# 6 being 6% and 0 being 0% difference. The 6% is enough to flag the table cell value
value["counts"][type]["diff_percent"] = (
6
if (in_count != 0 and out_count == 0) or (out_count > in_count)
else 0
)
else:
# Normalize the diff_percent depending on message types that are deduplicated to 1/hour
x = 3600 if type.lower() == "map" else 1
# Assign the calculated percentage difference between the in and out counts
# 6 (6%) is enough to flag a table cell value
value["counts"][type]["diff_percent"] = (
abs(out_count / -(-(in_count / x) // 1) - 1) * 100
if in_count != 0
else (6 if out_count > in_count else 0)
)

html += generate_table_row(rsu_ip, value, row_style, message_type_list)

0 comments on commit aeb0dec

Please sign in to comment.