Skip to content

Lg 12819-Team Judy metrics#11069

Merged
MrNagoo merged 6 commits intomainfrom
LG-12819/team-judy-metrics
Aug 13, 2024
Merged

Lg 12819-Team Judy metrics#11069
MrNagoo merged 6 commits intomainfrom
LG-12819/team-judy-metrics

Conversation

@MrNagoo
Copy link
Contributor

@MrNagoo MrNagoo commented Aug 12, 2024

🎫 Ticket

Link to the relevant ticket:
LG-12819

🛠 Summary of changes

Added 5 new metrics to the LG-99 report for team Judy.

📜 Testing Plan

Provide a checklist of steps to confirm the changes.

  • Added 5 new metrics for the LG-99 Email Report.
  • Added Specs for the 5 new metrics to verify the report output.

@MrNagoo MrNagoo requested a review from zachmargolis August 12, 2024 16:58

context 'when there are no users' do
it 'returns n/a' do
allow(User).to receive_message_chain(:joins, :group, :pluck).and_return([])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto about stubbing


def user_days_proofed_to_suspension_avg
user_data = User.where(uuid: data[Events::SUSPENDED_USERS]).joins(:profiles).
where.not(profiles: { verified_at: nil }).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that profile is proofed.

return 'n/a' if user_data.empty?

difference = user_data.map { |profiled_at, suspended_at| suspended_at - profiled_at }
(difference.sum / difference.size).seconds.in_days.round(2)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no point of day conversion function with rails.

before do
user6.destroy
user7.destroy
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice if there was a skip_let [list] macro.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could override by doing

let(:user6) { nil }
let(:user7} { nil }

and the users wouldn't get created

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that works! I didn't think that would happen in that order.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zachmargolis I had to add a changelog commit so I made the let changes.

@MrNagoo MrNagoo merged commit 862cc1c into main Aug 13, 2024
@MrNagoo MrNagoo deleted the LG-12819/team-judy-metrics branch August 13, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants