def send_email_report(profile, now=None):
    status = "started"
    if not now:
        now = datetime.datetime.utcnow()
    db.session.merge(profile)
    report = notification_report.make(profile)

    if report["cards"]:
        if os.getenv("ENVIRONMENT", "testing") != "production":
            email = profile.email
        else:
            email = "heather@impactstory.org"
        profile.last_email_sent = now

        try:
            db.session.commit()
        except InvalidRequestError:
            logger.info(u"rollback, trying again to update profile object in send_email_report for {url_slug}".format(url_slug=profile.url_slug))
            db.session.rollback()
            db.session.commit()

        msg = emailer.send(email, "Your latest research impacts", "report", report)
        status = "email sent"
        logger.info(u"SENT EMAIL to {url_slug}!!".format(url_slug=profile.url_slug))
    else:
        status = "not emailed, no cards made"
        # logger.info(u"not sending email, no cards made for {url_slug}".format(url_slug=profile.url_slug))

    return status
dataset/ETHPy150Open Impactstory/total-impact-webapp/tasks.py/send_email_report/operator `==` -> `!=`