Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

truncate data refresh percent change #808

Closed
wants to merge 3 commits into from
Closed
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
2 changes: 1 addition & 1 deletion openverse_catalog/dags/data_refresh/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def report_record_difference(before: str, after: str, media_type: str, dag_id: s
message = f"""
_Note: All values are row estimates and are not (but nearly) exact_
*Record count difference for `{media_type}`*: {before:,} → {after:,}
*Change*: {count_diff:+,} ({percent_diff:+}% Δ)
*Change*: {count_diff:+,} ({percent_diff:+.3f}% Δ)
"""
slack.send_message(
text=message, dag_id=dag_id, username="Data refresh record difference"
Expand Down
11 changes: 7 additions & 4 deletions tests/dags/data_refresh/test_reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
@pytest.mark.parametrize(
"before, after, expected_in_message",
[
["1", "2", ["1 → 2", "+1 (+100.0%"]],
["1", "3", ["1 → 3", "+2 (+200.0%"]],
["4", "2", ["4 → 2", "-2 (-50.0%"]],
["4000", "2000", ["4,000 → 2,000", "-2,000 (-50.0%"]],
["1", "2", ["1 → 2", "+1 (+100.000%"]],
["1", "3", ["1 → 3", "+2 (+200.000%"]],
["4", "2", ["4 → 2", "-2 (-50.000%"]],
["4000", "2000", ["4,000 → 2,000", "-2,000 (-50.000%"]],
["174290", "817198", ["174,290 → 817,198", "+642,908 (+368.873%"]],
["563561088", "564775616", ["563,561,088 → 564,775,616", "+1,214,528 (+200.000%"]],
["579553984", "579554880", ["579,553,984 → 579,554,880", "+896 (+0.000%"]],
],
)
def test_record_reporting(before, after, expected_in_message):
Expand Down