Email notifications for a specific test

166 views
Skip to first unread message

liam connolly

unread,
Nov 2, 2016, 1:43:04 PM11/2/16
to QATrack+
Hi there,
is it possible to set up an email notification for when a specific test list has been completed, regardless of the tolerance result? We currently have the rads perform a CBCT on a phantom weekly, and once it's done they usually phone one of the QA team. I've set up a test list to record the various things they currently write on paper, but it would be fantastic if upon completion an email would be fired off. 

Thanks,
Liam.

jon.d...@gmail.com

unread,
Nov 2, 2016, 2:00:46 PM11/2/16
to QATrack+
You may be able to do it similar to how I've approached some other tests. First create a boolean test, say "send email". Then create another test which is a string composite, say "status", which inputs the "send email" as a variable, such as:

if send_mail:
#do some code, such as email
status = 'email sent'
else:
status = 'pending'

You'll have to fill in the email code part. I've used this method to pull Daily QA 3 data into the QAT+ database quite easily. When the user select the boolean 'yes' for send mail, the string composite code will be executed.
Jon

Randle Taylor

unread,
Nov 2, 2016, 8:20:36 PM11/2/16
to QATrack+, jon.d...@gmail.com
There's no built in way to do this currently but it seems like a reasonable feature request.

Jon has an interesting approach.  To expand on it a bit,  you can send emails in composite calculations like:


from django.conf import settings
from django.core.mail import send_mail
   
user = getattr(settings, "EMAIL_NOTIFICATION_USER", None)
pwd = getattr(settings, "EMAIL_NOTIFICATION_PWD", None)
from_address = getattr(settings, "EMAIL_NOTIFICATION_SENDER", "QATrack+")
recipients
= ["a...@b.com", "d...@e.fgh"]
subject = "Test List Complete!"
body
=  "Your message here"
send_mail(
    subject, body,
    from_address, recipients,
    auth_user=user, auth_password=pwd,
    fail_silently=True
)

The only other thing I can think of is having a constant test with a tolerance applied to it that makes it "fail" which will trigger a notification email.

Randy

Matt B

unread,
Nov 3, 2016, 5:08:38 AM11/3/16
to QATrack+, jon.d...@gmail.com
Hi,

We have achieved similar using a boolean test called "Physics Review Required".
If the user selects 'Yes' then it is flagged for review, if 'no' is selected then it would not flag.

Matt

It does involve the user selecting 'Yes', but it works for us.

liam connolly

unread,
Nov 3, 2016, 8:06:14 AM11/3/16
to QATrack+, jon.d...@gmail.com
Excellent, I'll give it a go and let you know how it went!
Thanks a bunch.

Randle Taylor

unread,
Nov 6, 2016, 8:25:01 PM11/6/16
to QATrack+
I've filed a ticket on the QATrack+ issue tracker for this.

liam connolly

unread,
Nov 23, 2016, 12:12:55 PM11/23/16
to qat...@googlegroups.com
Got it all working nicely, but now I have yet another question! Do you think it's possible to grab the contents of any comments sections? Is there a secret META variable? It would be nice if I could include comments in the emails that get sent. It's not essential though.


Randle Taylor

unread,
Nov 23, 2016, 8:20:27 PM11/23/16
to QATrack+
You bet!

You can add a new file in qatrack/notifications/templates/ called say "custom_notification_email.txt" or something,  with contents like in this snippet: https://bitbucket.org/snippets/randlet/boGbg 

Then add a variable to your local_settings.py file:


EMAIL_NOTIFICATION_TEMPLATE = "custom_notification_email.txt"


and restart your server.

Randy
Reply all
Reply to author
Forward
0 new messages