Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new feature to count messages by date #272

Merged
merged 2 commits into from
Oct 5, 2020
Merged

Add new feature to count messages by date #272

merged 2 commits into from
Oct 5, 2020

Conversation

WLSF
Copy link
Contributor

@WLSF WLSF commented Oct 5, 2020

Description

Added 2 new functions on reporting.ex:

  1. count_sent_messages/0 (fetch messages that contains user_id, grouped by date)
  2. count_received_messages/0 (fetch messages that contains customer_id, grouped by date)

Issue

#255

Screenshots

N/A updates on frontend

Checklist

  • Everything passes when running mix test
  • Ran mix format
  • No frontend compilation warnings

Copy link
Collaborator

@reichert621 reichert621 left a comment

Choose a reason for hiding this comment

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

looks great @WLSF! just one small request to give the methods slightly more descriptive names 😄

@@ -31,6 +31,20 @@ defmodule ChatApi.Reporting do
|> Repo.all()
end

def count_sent_messages() do
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's rename this to count_sent_messages_by_date, so that it's clearer what the output looks like :)

(otherwise it sounds like this method returns a number)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, makes sense! thanks!

|> Repo.all()
end

def count_received_messages() do
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as above, let's just add _by_date to the end of this method's name to make it clear what's going on 👍

%{date: ~D[2020-09-02], count: 1},
%{date: ~D[2020-09-03], count: 1}
] = Reporting.count_received_messages()
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

hooray for tests! 🎉

@WLSF WLSF requested a review from reichert621 October 5, 2020 01:05
Copy link
Collaborator

@reichert621 reichert621 left a comment

Choose a reason for hiding this comment

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

awesome, thanks for the quick turnaround on this! 🚀

@reichert621 reichert621 merged commit 4da012c into papercups-io:master Oct 5, 2020
@reichert621
Copy link
Collaborator

let me know if there are any other tickets you'd be interested in tackling @WLSF 😁

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