# Create your views here.
+from datetime import datetime
+
#from django.template import Context, loader
#shortcut to the above modules
from django.contrib.auth.decorators import user_passes_test
from htsworkflow.frontend.experiments.models import *
from htsworkflow.frontend.experiments.experiments import \
estimateFlowcellDuration, \
+ estimateFlowcellTimeRemaining, \
+ roundToDays, \
getUsersForFlowcell, \
makeEmailLaneMap
email_lane = makeEmailLaneMap(fc)
flowcell_users = getUsersForFlowcell(fc)
- estimate_low, estimate_high = estimateFlowcellDuration(fc)
+ estimate = estimateFlowcellTimeRemaining(fc)
+ estimate_low, estimate_high = roundToDays(estimate)
email_verify = get_template('experiments/email_preview.html')
- email_template = get_template('experiments/started_email.html')
+ email_template = get_template('experiments/started_email.txt')
sender = settings.NOTIFICATION_SENDER
warnings = []
u'runfolder': 'blank',
u'finish_low': estimate_low,
u'finish_high': estimate_high,
+ u'now': datetime.now(),
})
# build view
- subject = "Flowcell %s" % ( fc.flowcell_id )
+ subject = "Flowcell %s" % ( fc.flowcell_id )
body = email_template.render(context)
if send:
email = EmailMessage(subject, body, sender, to=[user_email])
if bcc_managers:
- print 'bcc_managers', bcc_managers
email.bcc = settings.MANAGERS
- print email.to, email.bcc
email.send()
emails.append((user_email, subject, body, sending))
verify_context = Context({
- 'send': send,
- 'warnings': warnings,
'emails': emails,
+ 'flowcell': fc,
'from': sender,
+ 'send': send,
'site_managers': settings.MANAGERS,
+ 'title': fc.flowcell_id,
+ 'warnings': warnings,
})
return HttpResponse(email_verify.render(verify_context))