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

Newsletter task instruction confusing #1499

Closed
Nanonej opened this issue Jul 4, 2024 · 2 comments · Fixed by #1500
Closed

Newsletter task instruction confusing #1499

Nanonej opened this issue Jul 4, 2024 · 2 comments · Fixed by #1500

Comments

@Nanonej
Copy link
Contributor

Nanonej commented Jul 4, 2024

Implement the `Newsletter.send_newsletter/3` function. It should take a path of the file with email addresses, a path of a log file, and an anonymous function that sends an email to a given email address. It should read all the email addresses from the given file and attempt to send an email to every one of them. If the anonymous function that sends the email returns `:ok`, write the email address to the log file, followed by a new line. Make sure to do it as soon as the email is sent. Afterwards, close the log file.

Hey! I just did this exercise with a friend and we got stuck as we were confused by the task instruction and what the tests were checking.

The task ask us to log the email address when the passed function return :ok.
To do it we're instructed to open and close the logfile and to Make sure to do it as soon as the email is sent.
So we both understood by that, that we should enumerate the email list and try to send the email and thus logging it on success by opening and closing the logfile on each one of them.

But to do that we used the mode :append on the File.open to prevent the overwrite, which was highlighted as an essential issue when submitting the exercise. Also we had to manually reset the logfile on the first operation of this function task as the test 14 was checking that.

So I think either some information are missing in the instruction of this task or the part Make sure to do it as soon as the email is sent is a bad formulation of what it's expected.

@Nanonej Nanonej changed the title Task instruction confusing Newsletter task instruction confusing Jul 4, 2024
@angelikatyborska
Copy link
Contributor

The sentence "make sure to do it as soon as the email is sent." refers to the closest preceding instruction which is "write the email address to the log file, followed by a new line".

To make this clearer, we could replace "to do it" with a repetition of the previous instruction, for example:

Implement the Newsletter.send_newsletter/3 function. It should take a path of the file with email addresses, a path of a log file, and an anonymous function that sends an email to a given email address. It should read all the email addresses from the given file and attempt to send an email to every one of them. If the anonymous function that sends the email returns :ok, write the email address to the log file, followed by a new line. Make sure to write the email address to the log file as soon as the email is sent to that one email address. After all sending is done, close the log file.

@Nanonej
Copy link
Contributor Author

Nanonej commented Jul 4, 2024

The sentence "make sure to do it as soon as the email is sent." refers to the closest preceding instruction which is "write the email address to the log file, followed by a new line".

Yes, that's exactly why we got confused!

Maybe only the last modification is necessary as it's what we could have needed to understand at which step we were expected to open/close the logfile.
"After all sending is done" make it clear for the close and so the open before.
Make sure to do it as soon as the email is sent for the write seemed clear enough 🙂.

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 a pull request may close this issue.

2 participants