scizen9 / sedmpy

SED Machine Instrument Software Repository
5 stars 4 forks source link

Email to the users when request changes status #3

Closed nblago closed 5 years ago

nblago commented 5 years ago

Send an email to the user that submitted the request once the request they submitted chagnes status: from PENDING to OBSERVED, REDUCED, COMPLETED, etc.

scizen9 commented 5 years ago

The growth.py script now prints out the requestor's e-mail and the observation status. We need to implement actually sending an e-mail.

rswalters commented 5 years ago

dqm_update 20: Now contains a simple function inside the class SedmDb to send different emails. It can be called as followed

x = SedmDB(host="pharos.caltech.edu") template_dict = {'object_name': 'Test', 'new_status': 'NEW', 'status_change_time': datetime.datetime.utcnow()}

x.send_email_by_request(to='user@email', subject="Test", template='status_update', template_dict=template_dict)

The templates are stored in the db/email_templates. Each template is expecting a dictionary that contains the keywords inside the {} brackets.

scizen9 commented 5 years ago

Is it ready for a pull request, or do you need to do more testing?

rswalters commented 5 years ago

All the pieces are now in place to preform this action of reporting changes in states. We still need an institutional decision on whether to spam users with 5-6 updates/target request or if we just do one or two summary emails.