kimeraapp / pythonjobs.ie

Python jobs Ireland
http://pythonjobs.ie
GNU General Public License v2.0
30 stars 28 forks source link

Report job : Implements #34 #114

Closed NakitaOza closed 2 years ago

NakitaOza commented 7 years ago

Hi,

This implements #34 : 1) Report button for each job 2) Number of report clicks stored in db 3) If number of reports is equal to 5, send an email. SMTP server = SendGrid Mail sender email id = job-reports@pythonjobs.com Mail receiver email id = The email id mentioned in job posting

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-2.5%) to 97.191% when pulling 5eafae57816b89cad0d6139e8f2971802962ffe8 on NakitaOza:report_job into 201e6b57a593c4becbf7c8056a734649e6496ccd on kimeraapp:master.

edgarlatorre commented 7 years ago

Hi @NakitaOza thanks for your PR, would you mind to explain how you've implemented that? Also there's some empty lines and commented code.

NakitaOza commented 7 years ago

@edgarlatorre Hi, Apologies....Ill clean up the code.

The Implementation is as below:

1) Report button for each job:

File: jobs/templates/show.html , pythonjobs/static/css/base.css Added a "Report!" button, and gave it a title "Trouble?". Added css accordingly in base.css file.

2) Number of report clicks stored in db AND 3) If number of reports is equal to 5, send an email :

File: jobs/urls.py As soon as the report button is clicked, url "/report" is called. This is added in the urls.py file. It is linked to the "report" view. The name given to this url pattern is "report-click".

File: jobs/models.py A new Integer field named "report_clicks", measuring the number of times the report button was clicked for a particular job, was added to the db.

File: jobs/views.py A view function called "report" was created. It would get the current number of report_clicks from the db(job.report_clicks), add 1 to it, and save it back in the db. If the final number of clicks for that particular job is equal to 5, an email will be sent. The email id of the receiver is taken from the db (job.email) As discussed before, the SMTP sever used was SendGrid. I used my personal mail id to create an account on it. The sender's mail id : job-reports@pythonjobs.com Mail will be sent only when the number of reports is equal to 5, not more then that.

Once the report button is clicked, the user is redirected to "job-home" view ,i.e., the homepage (index.html) Hence, the return value of this view function is redirected to "job-home" url.

Please let me know if you need anything else.

Thanks a lot!!!

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-1.09%) to 98.611% when pulling 4fe20dec91a35b25ad6f1ec87220ce17512190cd on NakitaOza:report_job into 201e6b57a593c4becbf7c8056a734649e6496ccd on kimeraapp:master.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.02%) to 99.722% when pulling 7a58dad124b69ffc39549365ceb4cc4b6b41f6a2 on NakitaOza:report_job into 201e6b57a593c4becbf7c8056a734649e6496ccd on kimeraapp:master.

NakitaOza commented 7 years ago

@edgarlatorre Hi, I have also added test for the implemented code to improve the coverage. Thanks!